Explain how you can fetch data from database in UFT?
Set db= createobject (“ADODB.Connection”)
db.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\guru99\vb6\admission_project.mdb;
Persist Security Info= False”
Set rst=createobject(“ADODB.Recordset”)
rst.Open “select*from Course”, db, 3
id=rst. RecordCount
For i=0 to id-1
Print rst.field (0) & rst.fields (1) & rst.fields (2) & rst.fields (3)
rst.Movenext
Next
UFT         QTP         Automation Testing         Software Testing        
Your Answer: 

1 Answers

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objCon=CreateObject("ADODB.Connection") 
Set objRec=CreateObject("ADODB.Recordset")
objCon.Open "DRIVER={Oracle in OraHome92};SERVER={Servername};UID={Username};PWD={Password};DBQ={Dbnmae}"
objRec.CursorLocation = adUseClient
objRec.Open "Select {Col name} from tablename",objCon,adOpenStatic,adLockOptimistic
While(objRec.EOF)
    objRec.MoveNext
    Msgbox "Result" & objRec.Fields.Item("{Col name}")& vbCrLf 
Wend

objRec.Close
objCon.Close
Set objRec=Nothing
Set objCon=Nothing
Msgbox "Executed Sucessfully"



Regards
Mathew Wade

Answered On 2nd Oct,2017, 6:09am
Edit Account
LOGIN INFORMATION
Change Settings
Email Notifications Notifications will be sent to abcd@gmail.com
Select option for your email notifications:
Mature / News Filter We'll send on email when new jobs are posted
Option 2 for email notification We'll send on email when new jobs are posted