Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing Data from a Database
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Rajeshwar,

Please find the below code which i have done on flight application.

The following code fetch the data from database to data table.

Code:
Dim adocon,adorecordset
Set adocon=CreateObject("ADODB.Connection")
constr="DSN=QT_Flight32;DBQ=C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight32.mdb;Driver=C:\WINDOWS\system32\odbcjt32.dll;DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5"
adocon.Open constr
Set adorecordset=CreateObject("ADODB.Recordset")
Set adorecordset.ActiveConnection=adocon
Strsql="Select  *  from orders"
adorecordset.Source=Strsql
adorecordset.Open
set outsheet=Datatable.Addsheet("output")
For each fld in adoRecordset.Fields
outsheet.AddParameter fld.name,""
Next
i=1
Do while Not adorecordset.EOF
DataTable.SetCurrentRow(i)
For each fld in adorecordset.Fields
outsheet.GetParameter(fld.name).value=fld.value
Next
adorecordset.MoveNext
i=i+1
Loop
Wait 5

Please let me know for further clarification.

Regards,
Venkat. Batchu
Reply


Messages In This Thread
Importing Data from a Database - by rajeshwar - 05-26-2010, 12:44 PM
RE: Importing Data from a Database - by Saket - 05-26-2010, 01:03 PM
RE: Importing Data from a Database - by rajeshwar - 05-26-2010, 02:48 PM
RE: Importing Data from a Database - by venkatbatchu - 08-27-2010, 04:12 PM
RE: Importing Data from a Database - by qtp-qa - 04-03-2012, 12:23 AM
RE: Importing Data from a Database - by lotos - 09-14-2010, 08:45 PM
RE: Importing Data from a Database - by lotos - 11-23-2010, 08:40 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Importing excel not working Adam82 6 13,600 11-05-2012, 05:22 PM
Last Post: Adam82
  it is possible import from excel to table with expected data of checkpoint database i sarcastic 0 2,256 08-05-2011, 04:42 PM
Last Post: sarcastic
Smile importing objects and properties to excel sheet sandy.jakhar 2 3,686 03-16-2011, 03:26 PM
Last Post: sandy.jakhar
  mapping database user to database kamalteja 4 4,687 11-03-2010, 11:58 AM
Last Post: kamalteja
  Data importing from excel using script vaigundamoorthy 3 3,717 05-19-2009, 04:53 PM
Last Post: lit_73

Forum Jump:


Users browsing this thread: 4 Guest(s)