How to Create Database Checkpoint manually in QTP

Is it possible to write a sql query manually in the QTP script to create a DB checkpoint instead of going through the MS SQL QUERY tool ?

thanks
Sai

Questions by sairam100   answers by sairam100

Showing Answers 1 - 2 of 2 Answers

hpruthi

  • Dec 26th, 2007
 

Yes it is possible to execute the query without using the "Microsoft Query". You just need to choose the other option in the Database Query Wizard i.e. "Specify SQL statement manually"

In case you do not use to use database query wizard at all and go about database testing in that case you will have to use prgoramming in ur script. You will first have to crearte the Adodb connection object and the recodset objet. These two objects will then be used to open the database connnection and to fetch the record in recodset. Thereafter you can use the fetched data any way you want to

Following sample code can help you undestand this better

Dim con, rs,strSQL  'Explicit Declaraion of variables
Set con=Createobject("ADODB.Connection")  'Create a  connection object
Set rs=Createobject("ADODB.recordset")  'Create a recordset  object
rs.CursorLocation = 3
rs.CursorType =3

connSTR= "DSN=OracleDataBase;UID=hpruthi;password=hpruthi;"  'Define the connection string
con.open connSTR  'Open the database connection
strSQL="Select * from claim where paid_date = '8-OCT-2002' and paid_total < 100  and member_id = 800045021"  'SQL query'

rs.open strSQL, con

i=rs.recordcount
msgbox i

For x=1 to i
 datatable.SetCurrentRow (x)
 Datatable.Value("VAL", dtglobalsheet)=rs("Claim_key")
 
   ' msgbox "Test"
 rs.movenext 'move to the next record in the recordset
Next

rs.close
con.close

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions