qtp script to connect access database
DESCRIPTION
QTP,VBScript,qtp script,qtp scripts,Automation,automation framework,automation estimation technique,automation estimation technique, QTP Interview questions,QTP real time scripts,sample vbscripts,QTP Sample Certification questions, qtp exam questions, hp qtp certification questions, QTP Certification HPO-M16 - Skill Review Test,QTP Guide, QTP Testing, Quick Test, QuickTest Professional, quicktest Pro,quicktest professional,qtp tutorial,qtp 10 tutorial,automation frameworks, qtp framework, test automation by qtpTRANSCRIPT
Fore more QTP Realtime scripts, visit www.ramupalanki.com
Function obj_UDF_getRecordset (strFileName, strSQLStatement)
Dim objAdCon, objAdRs
Set objAdCon = CreateObject(“ADODB.Connection”)
objAdCon.Open “DRIVER={Microsoft Access Driver (*.mdb)};DBQ=”&strFileName & “;Readonly=True”If Err 0 ThenReporter.ReportEvent micFail,”Create Connection”, “[Connection] Error has occured. Error : ” & ErrSet obj_UDF_getRecordset = NothingExit FunctionEnd IfSet objAdRs = CreateObject(“ADODB.Recordset”)objAdRs.CursorLocation=3 ‘ set the cursor to use adUseClient – disconnected recordsetobjAdRs.Open strSQLStatement, objAdCon, 1, 3
While objAdRs.EOF=falseFor i=0 to 4msgbox objAdRs.fields(i)NextobjAdRs.moveNextWend
If Err0 ThenReporter.ReportEvent micFail,”Open Recordset”, “Error has occured.Error Code : ” & ErrSet obj_UDF_getRecordset = NothingExit FunctionEnd If
Set objAdRs.ActiveConnection = Nothing
objAdCon.CloseSet objAdCon = Nothing
Set obj_UDF_getRecordset = objAdRs
End Function
Set rsAddin = obj_UDF_getRecordset(“C:\Documents and Settings\mohank\Desktop\Login.mdb”, “Select * from Login”)