How to connect to data base?

Answer Posted / akshay

Public Function database(Str,SQLstr,outResult1,outResult2)

'//Variable Declarations
Dim objConn, rsOut

'//Create a connection object.
Set objConn = CreateObject("ADODB.Connection")

'//Create a ResultSet Object to store the results.
Set rsOut = CreateObject("ADODB.Recordset")

'//Open the Created Connection object
objConn.Open Str

'//Pass the SQL query string and retrieve the Results
through the connection object
rsOut.Open SQLstr,objConn

If rsOut.EOF <> True AND rsOut.BOF <> True Then

'//Store the different column values
retrieved from a record in different variables.
outResult1=rsOut("col1")

outResult2=rsOut("col2")

rsOut.movenext
End If

End Function

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Did the scripts need lot of maintenance? If yes, why?

3275


To retrive the test data which tool vl use and whats basis u vl write test data? its urgent

1419


QTP 10.0 is not identifying web objects for IE 8.it is identifying like winObject.I installed HP patch QTPWEB_00037.Still getting issue

5473


What is the Difference between test object and run time object?

581


How to write business scripts using object repository with different scenarios

1361






Hi. I have completed B.TECH(CS) , But I will go to "SECURITY CONSOLE OPERATING" [C.C CAMERA abservation]. IF interviwer asks " Why you choose this job ?" What we will say? urgent.........................urgent...........

1410


What is an optional step in qtp ?

603


What is keyword view in qtp?

529


Give the syntax to load function at run time.

593


Explain about datafile/verification of date file when file is not available in local system?

2203


Explain how you can find the absolute value of the number in qtp?

614


What is action?

554


Get the count of files of similar types from a folder.

946


How to test login module with different username and password by using data driven testing in QTP?

577


hi all can any body explain how to write the script for finding the mandatory fields which are having [red Astrik sign (*)]

1433