Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Importing Oracle Database data to RunTime datatable
#4
Solved: 10 Years, 9 Months, 2 Weeks ago
This will connect to ORacle and run a SQL query and return the results to the runtime datatable. It uses the field names from the query as the column names in the Excel format.


Code:
Dim adocon,adorecordset
Set adocon=CreateObject("ADODB.Connection")
constr="Provider=OraOLEDB.Oracle.1;Password=XXXX;Persist Security Info=True;User ID=XXXX;Data Source=Dev"
adocon.Open constr
Set adorecordset=CreateObject("ADODB.Recordset")
Set adorecordset.ActiveConnection=adocon
Strsql="Select 'TEST PRICE LIST:' || to_char(sysdate,' MM-DD-YY HH:MM:SS') as PRICE_LST_NAME from Dual"
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
Reply


Messages In This Thread
RE: Importing Oracle Database data to RunTime datatable - by jparson11 - 01-22-2011, 01:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Importing data sheet Santu 2 3,212 08-20-2015, 11:37 PM
Last Post: ADITI1992
Smile Importing Excel sheet - Reference Values are not recognized michiusa69 3 7,597 01-23-2015, 02:36 AM
Last Post: lkng2001
  Find a text in Runtime datatable ra.dineshkumar@gmail.com 1 1,872 12-01-2014, 06:18 PM
Last Post: supputuri
  Invalid File error importing a spreadsheet but only on a VM msacks 1 2,580 10-19-2014, 09:04 PM
Last Post: supputuri
  Function writes data from datatable to database Fairbanks 0 2,403 06-27-2014, 07:51 PM
Last Post: Fairbanks

Forum Jump:


Users browsing this thread: 1 Guest(s)