Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using .mdb (Access DB) file in QC
#1
Solved: 11 Years, 4 Months, 2 Weeks ago
Hi,
I am going to use QC. But already i have QTP scripts which is using Access DB instead of Excel file/DataTable.
To connect to Access DB from QTP i am using DSN Less connection (i.e
oCnn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Trim(DbPath)&";Uid=;Pwd=;")

Now i need to use QC. How will i load the Access (.mdb) file into QC and get it connected to QTP???
Reply
#2
Solved: 11 Years, 4 Months, 2 Weeks ago
Code:
Set objConnection = CreateObject("ADODB.Connection")
With objConnection
  .ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ="&Trim(DbPath)&";Uid=;Pwd=;")
  .CommandTimeout = 60 'default is 30 secs
  .Open
End With

This might not be the right connection string, but you need to use the ADODB.Connection and ADODB.Recordset objects to connect and read data from the DB. You should be able to find plenty of examples on Google.
Oh, wait. I missunderstood the question.

You want to use the AccessDB instead of the Datatable? You can use the DB values in your script, but it will not duplicate the capabilities of the DataTable without you writing the code to do so. The datatable has some built in options like run all rows or single iteration. You can do that by using a DB recordset and a while/loop.

Sorry for misunderstanding.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP script to save the generated .csv file and excel file priya elangovan 0 4,415 08-29-2012, 04:17 PM
Last Post: priya elangovan

Forum Jump:


Users browsing this thread: 1 Guest(s)