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

What is expert view and keyword view?

860


What is qtpro?

813


Hi How to retrieve data from web element line by line?

1787


What environment does qtp run in?

792


How to use the object spy in quicktest professional (qtp) 8.0 version?

723


Have you faced any problems with object repository?

807


How can you write the scripts that operate on different objects depending on run-time information?

2347


Which scripting language used by quicktest professional?

734


what type of automation is follwed in the project?

1708


Write the code for,In the page screen we have total 10 Links,out of these I have to click 9th link

1071


What are the advantages of a Hybrid framework?

835


any body can you help me what is the script to automate an comand promt

2210


What is text check point and text area check point?

834


How to use output values in qtp ?

732


How can i check items sorted or not in a weblist ? Give me the script for this...

1803