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

I used the below code to open QTP through VBscript?But i can unable to Invoke QTP...PLZ help me with the correct code to invoke QTP through VBS with description of the code aswell. Dim qtApp 'As QuickTest.Application 'Declare the Application object variable Dim qtTest 'As QuickTest.Test 'Declare a Test object variable Dim qtResultsOpt 'Declare a Run Results Options object variable Set qtApp = CreateObject("QuickTest.Application") 'Create the Application object qtApp.Launch 'Start QuickTest qtApp.Visible = False 'Make the QuickTest application visible qtApp.Open "C:\form", True 'Open the test in read-only mode 'set run settings for the test Set qtTest = qtApp.Test qtTest.Run 'Run the test 'WScript.StdOut.Write "Status is: " & qtTest.LastRunResults.Status 'Check the results of the test run qtTest.Close 'Close the test qtApp.quit 'Close QuickTest Pro Set qtResultsOpt = Nothing 'Release the Run Results Options object Set qtTest = Nothing 'Release the Test object Set qtApp = Nothing 'Release the Application object

2420


Want to verify notepad reports using QTP framework or any other BV script method. Can anyone share the method to achieve it? Eg. Person Name is the header and the actual name is John then how can we verify weather person name is John

2165


How can i initiate the objects to find uniquely in OR

1464


can any boby tell me what is method or steps to connect the remote desk top by using QTP 9.2 version?

1619


what type of automation is follwed in the project?

1478






In qtp is it possible to check broken links of a page?

578


What are the differences between qtp and winrunner?

529


hi in real time who will execute the qtp test scripts? my faculty said, in a companty automation testers are written the test scripts and manual testers are execute the test scripts...IS IT RIGHT OR NOT?

2789


What are the Application Functions available in QTP?

1475


Hi, Can anyone please tell me how to connect the QC with QTP using QTP script? Thanks in advance

1519


I AM TRYING PORT CODE FROM WINRUNNER TO QTP AND DON'T KNOW TO HOW TO CHECK THE ERRORS. IN WINRUNNER FUNCTION RETURNS EIGHER 0 OR -1 AGAINST WHICH RESULT CAN BE MADE PASS OR FAIL BUT IN QTP I DON'T SEE FUNCTIONS RETURNING ANY VALUE. APPRECIATE IF ANYONE COULD HELP ME CONVERTING FOLLWOING WINRUNNER CODE TO QTP. set_window("Customer Service"); rc = web_obj_get_text("Summary","#2","#4",ssn,""," ",1); if (rc != E_OK) { report_msg("[GetSubscriberSummary] Could Not get subscriber SSN; rc = "&rc); myRC = rc; } else { ssn = StripBlank(ssn); if (DEBUG) report_msg ("[GetSubscriberSummary] SSN: "&ssn); }

1696


Explain the difference between data driven testing and parameterization ?

583


I used child objects to get the no of weblist present in the weblist.now i need to select the items present in each weblist ?How to do so

2254


how to test Web application using QTP software

1562


How many add-ins comes by default with quicktest professional (qtp)?

560