Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

How to Import the data from MS-Access in QTP?

This is a discussion on How to Import the data from MS-Access in QTP? within the QTP forums, part of the Software Testing category; Hi, Any one tell me How to Import the data from MS-Access in QTP?...

Go Back   Geeks Talk > Software Testing > QTP
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 12-05-2007
Contributing Member
 
Join Date: Oct 2007
Location: India
Posts: 36
Thanks: 4
Thanked 3 Times in 3 Posts
ramyamca1984 is on a distinguished road
How to Import the data from MS-Access in QTP?

Hi,

Any one tell me How to Import the data from MS-Access in QTP?
Reply With Quote
The Following User Says Thank You to ramyamca1984 For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 12-05-2007
Expert Member
 
Join Date: Oct 2007
Location: Mumbai
Posts: 354
Thanks: 4
Thanked 58 Times in 47 Posts
bizzzzzare will become famous soon enough
Smile Re: How to Import the data from MS-Access in QTP?

Hi Ramya,

You can use the same createObject method to export data from MS Access as well. Here is the code guideline for the following -

dim oConn
dim sRec

set oConn = createObject("ADODB.Connection")
oConn.open "Provider = Microsoft.Jet.OLEDB.4.0;DataSource = <
NOTE : Incase authentication is required as in case of SQL Server, we would have to pass UserID and Pwd as well.

set sRec = createObject("ADODB.Recordset")
sRec.open "Select * from where .... conditions", oConn, adLockOptimistic, adOpenDynamic

for i = 0 to rs.EOF
ar[i] = sRec.fields(i)
next

NOTE : Incase rs.EOF does not work, try the following code -

dim item
For each item in sRec.fields

Next
sRec.MoveNext

Cheers......
__________________
Regards,

V.Umesh Krishnan
QA Consultant
Reply With Quote
  #3 (permalink)  
Old 03-20-2008
Junior Member
 
Join Date: Feb 2008
Location: Phoenix
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
DeepG is on a distinguished road
Re: How to Import the data from MS-Access in QTP?

Thanks, this was a really useful post
Reply With Quote
  #4 (permalink)  
Old 03-20-2008
Expert Member
 
Join Date: Sep 2007
Location: Hyderabad
Posts: 115
Thanks: 1
Thanked 19 Times in 15 Posts
rajaputra is on a distinguished road
Re: How to Import the data from MS-Access in QTP?

Hi ramya, here you can use this code for getting data from database by using msaccess..

''''''''''''''To Retrieve the Data From Database''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''To retrieve the data from two tables''''''''''''''''''''''''''''


Dim Dsn_conn,rs

Set objConnection=Createobject("ADODB.Connection")'Create connection object with DSN
Dsn_conn= "DSN=QT_Flight32;DBQ=C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight32.mdb;Driver=C:\WINNT\system32\odbcjt32.dll;DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"
objConnection.Open(Dsn_conn)'Open the connection
Set rs=CreateObject("ADODB.RecordSet") 'Create recordset object
Set rs=objconnection.execute("select Orders.Customer_Name,Flights.Departure from Orders,Flights where Orders.Flight_Number=Flights.Flight_Number")

rs.MoveFirst
row=1
datatable.GetSheet(1).addparameter"Customer_Name",""
datatable.GetSheet(1).addparameter"Departure",""
While Not rs.EOF
ONumber=rs.fields.item("Customer_Name")
CName=rs.fields.item("Departure")
datatable.SetCurrentRow(row)
datatable.Value (1,1)=ONumber
datatable.Value(2,1)=CName
row=row+1
rs.movenext
Wend
objConnection.Close

_________________________
Thanks & Regards

Arun Singh Rajaputra

Last edited by rajaputra; 03-20-2008 at 01:07 PM.
Reply With Quote
  #5 (permalink)  
Old 03-20-2008
Expert Member
 
Join Date: Sep 2007
Location: Hyderabad
Posts: 115
Thanks: 1
Thanked 19 Times in 15 Posts
rajaputra is on a distinguished road
Re: How to Import the data from MS-Access in QTP?

Hi Ramya,

Here you can use this code for getting data from database by using msaccess..


''''''''''''''To Retrieve the Data From Database''''''''''''''''''''''''''''''''''''''''''''''''''''

'''''To retrieve the data from two tables''''''''''''''''''''''''''''


Dim Dsn_conn,rs

Set objConnection=Createobject("ADODB.Connection")'Create connection object with DSN
Dsn_conn= "DSN=QT_Flight32;DBQ=C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight32.mdb;Driver=C:\WINNT\system32\odbcjt32.dll;DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;"
objConnection.Open(Dsn_conn)'Open the connection
Set rs=CreateObject("ADODB.RecordSet") 'Create recordset object
Set rs=objconnection.execute("select Orders.Customer_Name,Flights.Departure from Orders,Flights where Orders.Flight_Number=Flights.Flight_Number")

rs.MoveFirst
row=1
datatable.GetSheet(1).addparameter"Customer_Name",""
datatable.GetSheet(1).addparameter"Departure",""
While Not rs.EOF
ONumber=rs.fields.item("Customer_Name")
CName=rs.fields.item("Departure")
datatable.SetCurrentRow(row)
datatable.Value (1,1)=ONumber
datatable.Value(2,1)=CName
row=row+1
rs.movenext
Wend
objConnection.Close

_____________________
Thanks & Regards

Arunsingh Rajaputra
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Unable to import data into local sheet Geek_Guest QTP 4 05-27-2009 02:19 AM
How to Import the data from MS-Excel in QTP? ramyamca1984 QTP 11 03-23-2009 12:58 PM
access outside data from iframe... psuresh1982 Web Design 0 07-31-2007 05:11 AM
Data Access Layer For Microsoft Access Lokesh M VB.NET 0 12-02-2006 11:35 AM
Microsoft CRM : 5 ways to import data Jim.Anderson Microsoft CRM 0 09-27-2006 07:39 AM


All times are GMT -4. The time now is 03:53 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved