Micro Focus QTP (UFT) Forums
Testing access database - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Testing access database (/Thread-Testing-access-database)



Testing access database - shipu - 01-30-2014

Hello,

I am testing access database(.accdb extention) using qtp 11. When I spy on the table, it is not recognizing column by column. How can I select a specific column?

Please see the attached.

Thanks.

-S


RE: Testing access database - shipu - 01-30-2014

Hi,

I did the below:


QTP software is installed in C drive.

I created a access database with accdb ext. Name of db is test.accdb. I saved it in H:\qtp

I created a dsn connection. Name is dsna.I added the test.accdb in the dsna connection. I gave password under advanced option.

In QTP, I wrote as:

Code:
myDSN="dsn=dsna;uid=hr;pwd=hr;"  
Set con= CreateObject("ADODB.Connection")  
Set rs = CreateObject("ADODB.Recordset")  

con.Open myDSN

I am getting error at the last line saying 'can not open data base.....'.

Any advise please.

Thanks.

-S


RE: Testing access database - supputuri - 01-30-2014

HI S,

Try the this code.
Code:
Set oAccess= CreateObject("ADODB.Connection")
oAccess.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\qtp\test.accdb"
If oAccess.State = 1 Then
    Msgbox "Pass"&vbcrlf&"Database Connection"&vbcrlf&"Database Connection is Open"
Else
   Msgbox "Fail" &vbcrlf&"Database Connection" &vbcrlf&"Database Connection is not Open"
End If



RE: Testing access database - shipu - 01-30-2014

Hi,

When I access the DB, it only asks for password. So I added the password. I get error: could not find installable ISAM.

Please advise.

Code:
Set oAccess= CreateObject("ADODB.Connection")
oAccess.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=H:\qtp\test.accdb;pwd=df"
If oAccess.State = 1 Then
     Msgbox "Pass"&vbcrlf&"Database Connection"&vbcrlf&"Database Connection is Open"
Else
    Msgbox "Fail" &vbcrlf&"Database Connection" &vbcrlf&"Database Connection is not Open"
End If