Micro Focus QTP (UFT) Forums
Using .mdb (Access DB) file in QC - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Using .mdb (Access DB) file in QC (/Thread-Using-mdb-Access-DB-file-in-QC)



Using .mdb (Access DB) file in QC - manojith1984 - 11-12-2009

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???


RE: Using .mdb (Access DB) file in QC - jsknight1969 - 11-13-2009

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.