Print Page | Close Window

Donate a user defined function to this topic

Printed From: One Stop Testing
Category: Testing Tools @ OneStopTesting
Forum Name: QuickTest Pro @ OneStopTesting
Forum Discription: QuickTest Pro is a fresh approach to automated software and application testing that addresses testing needs of both business analysts and Quality Assurance professionals.
URL: http://forum.onestoptesting.com/forum_posts.asp?TID=1443
Printed Date: 17Jul2025 at 3:21am


Topic: Donate a user defined function to this topic
Posted By: tanushree
Subject: Donate a user defined function to this topic
Date Posted: 05Jun2007 at 4:00am
Function GetDataFromDatabase(sDatabaseName,sUID,sPWD,sSQL)	'Declare the array
dim DbArray()

TotalRow=GetRowsCountFromDatabase(sDatabaseName,sUID,sPWD,sSQL)
'Create the connection string:
strConn="DRIVER={Microsoft ODBC for Oracle};SERVER=" & sDatabaseName & ";User ID=" & sUID & ";Password=" & sPWD & " ;"

'Establish the connection:
Set oConn = CreateObject("ADODB.Connection")
'Server-side cursor
oConn.CursorLocation = 2
oConn.Open strConn

'Create a recordset to hold the results
Set rs = CreateObject("ADODB.Recordset")
'Options for CursorType are: 0=Forward Only, 1=KeySet, 2=Dynamic, 3=Static (read-only)
rs.CursorType = 3
Set rs.ActiveConnection = oConn
'Execute the query and put the results into the recordset
rs.Open sSQL

NumberOfColumn=rs.fields.count

' Verify record set is not null or empty
if rs.RecordCount <= 0 then
Reporter.ReportEvent micFail,"Data NOT FOUND for SQL:",sSQL
ExitAction(0)
end if

' Resize the array
ReDim DbArray(TotalRow,NumberOfColumn)

i=0
j=0
' Assign recordset to an Array
Do While Not rs.eof
For j = 0 to NumberOfColumn - 1
DbArray(i,j)=rs.fields(j).value
Next
rs.MoveNext
i=i+1
loop

'Close the Recordset
rs.close
' Clear the connection string
Set strConn=nothing
' Clear the connection to a database
Set oConn=nothing
GetDataFromDatabase=DbArray

End Function



Replies:
Posted By: navinpandey2000
Date Posted: 03Jul2007 at 10:22pm

Hi , while i run my application (developed in ASP.net) after recording in QTP9.2 i m facing problem stated below...........I had also download add_in for .net but still it is not running.......please give me appropriate solution for this

Cannot identify the object "ctl00$ContentPlaceHolder1$srch" (of class WebList). Verify that this object's properties match an object currently displayed in your application.



Print Page | Close Window