07-28-2008, 01:19 PM
Hi Sridhar ,
The following code is working ,but here in the test results pane it showing me the data in the data table but not in the Expert view window .
I believe we need to save so any function to save such as rs.save
The following code is working ,but here in the test results pane it showing me the data in the data table but not in the Expert view window .
I believe we need to save so any function to save such as rs.save
Code:
'Data base connection'
Set conn=CreateObject("ADODB.Connection")
conn.Open("DRIVER={Oracle in OraHome92};SERVER=DEVMITG;UID=ITL_ASSET;PWD=ITL_ASSET;DBQ=DEVMITG")
'rs connection record set'
Set rs = CreateObject("ADODB.recordset")
' Specify the query'
sql = "Select Code, Meaning From TB_AMS052_Codes Where Code_Nam = 'Pole' "
'ctr=0
'Execute the Query’
rs.open sql,conn
'Get the no records returned by query’
' Code.GetROProperty (Property, [PropertyData])
'Adding a column to datatable’
For each fields in rs.fields
DataTable.GlobalSheet.AddParameter fields.name , ""
Next
rs.MoveFirst
iRow = 1
Do
DataTable.SetCurrentRow iRow
'DataTable("Code",dtGlobalSheet) = rs.fields("Code")
DataTable("Meaning",dtGlobalSheet) = rs.fields("Meaning")
iRow = iRow + 1
rs.save
rs.MoveNext
loop until rs.EOF
'Get the values from the Meaning column’
While(NOT rs.EOF)
' ctr=ctr+1
' For i=1 to Recordcount
' Msgbox rs.Fields("code "+"meaning")
' Msgbox (rs.Get Row )
' Msgbox rs.Fields("Meaning")
' DataTable.SetCurrentRow(i)
'Writing the data to the datatable’
' DataTable("Meaning",DtGlobalSheet) = rs.Fields("Meaning")
rs.MoveNext
' Next
' ctr=ctr+1
wend
' Msgbox (ctr-1)
'close the database connection’
'DataTable.Export "C:\DatabaseExample.xls"
rs.close
conn.close