Can anybody give me the script for inserting data into a table of access through qtp

Showing Answers 1 - 1 of 1 Answers

Jayalakshmi

  • Dec 18th, 2006
 

VBScript File -
--------------

Public function DbDemo(param1)

Dim Cnxn, strCnxn
Dim rsCustomers, strSQLCustomers
Dim fld, Err

Set Cnxn = CreateObject("ADODB.Connection")
Set rsCustomers = CreateObject("ADODB.RecordSet")
strCnxn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Program FilesMercury InteractiveQuickTest Professionalsamples lightapp light32.mdb;User Id=admin;Password=;"
            Cnxn.Open strCnxn

MsgBox "connected"

rsCustomers.Open strSQLCustomers, Cnxn, 3, 3, &H0001

strSQLCustomers = " Insert into OrderTable(Customer_Name) values ='" & param1 & "'"

Cnxn.Close

End function


QTP Script -
------------

CustName = Datatable(Customer_Name,dtGlobalsheet)'getting the value(Customer Name) from the DataTable

ExecuteFile "C:DbDemo.vbs" 'Executing the VBscript File
DBDemo(CustName) 'Calling the Function in the VBScript File

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions