Please provide instruction of code.
Please provide instruction of code.
'''connection to the database
set conn=createobject("adodb.connection") 'on error resume next
conn.provider="microsoft.jet.oledb.4.0" conn.open "\\infpu01673\database\web_auto.mdb"
if err.number <>0 then
'reporter.reportevent micpass,"database connection","successfully connected."
end if
if isempty(conn) then
'reporter.reportevent micfail, "database connection","connection failed error code:<<" & & ">>"
end if
'''fetch records
set rs = createobject("adodb.recordset")
set rs = conn.execute("select * from tbl_seq_flow where script_name ='" & scriptname & "' order by object_sequence")
while not rs.eof
int_oid_cnt = 0
flag = 1
intlch = rs.fields.item(1)
rs.movenext
wend
'''the above code is from my active-script..i have higlighted ur requirement for the post.
Regards,
Nawab
Last edited by NawabShaikh; 06-10-2008 at 12:00 AM. Reason: Alignment
Thanks, i have tried that code but giving me exception
Hi,
You can try below script.
I have taken example for flight application for easy understanding.
Below script will retrieve the data from the flight application database, and display the result in runtime data table.
Here I am trying to retrieve the Customer Name and Order Number from the database.
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 Order_Number,Customer_Name from Orders where
Order_Number<10")'Execute the query
rs.MoveFirst
row=1
datatable.GetSheet(1).addparameter"Customer_Name",""
datatable.GetSheet(1).addparameter"Order Number",""
While Not rs.EOF
CName=rs.fields.item("Customer_Name")
CNumber=rs.fields.item("Order_Number")
datatable.SetCurrentRow(row)
datatable.Value (1,1)=CName
datatable.Value(2,1)=CNumber
row=row+1
rs.movenext
Wend
'Close the connection
''''Run and see the runtime data table.
Last edited by rajaputra; 06-11-2008 at 12:17 PM.
__________________
Thanks & Regards!!
RAJAPUTRA
Hi,
Can you look into the below code and cerrect them - I am not sure with the object.open.
If I want it to be used in multiple scripts, which the effective way for it to be scripted - make it as VB funtion or Sub routine?
==========================================================
datatable.ImportSheet "c:\Testing\Testing.xls", 1, "Global"
Dim url, cdetDBQ, dceiDBQ, itcDBQ
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objCon=CreateObject("ADODB.Connection")
Set objRec=CreateObject("ADODB.Recordset")
url = datatable.Value("url", dtGlobalSheet)
datatable.SetCurrentRow(1)
t1 = datatable.Value("t1", dtGlobalSheet)
t2 = datatable.Value("t2", dtGlobalSheet)
t3 = datatable.Value("t3", dtGlobalSheet)
'Establish connection - Need more informaton
Select Case url
Case 1 '
objCon.Open "DRIVER={Oracle in OraHome92};SERVER={Servername};UID={uid};PWD={pwd};DBQ={databasnem}"
Case 2 '
objCon.Open "DRIVER={Oracle in OraHome92};SERVER={Servername};UID={uid};PWD={pwd};DBQ={databasnem}"
Case 3 '
End Select
objRec.CursorLocation = adUseClient
' Fetch tempt UID
objRec.Open "SELECT substr(body, instr(body, 'User ID: ')+9, instr(body, 'Password: ')) FROM schema.table",objCon,adOpenStatic,adLockOptimistic
' Fetch tempt PWD
objRec.Open "SELECT substr(body, instr(body, 'Password: ')+10, instr(body, '3. Follow')) FROM schema.table",objCon,adOpenStatic,adLockOptimistic
'While(objRec.EOF) - since the queue is turned on, there will be only ONE row per few seconds
' objRec.MoveNext
Msgbox "Result" & objRec.Fields.Item("{Col name}")& vbCrLf
'Wend
' Flush out
objRec.Close
objCon.Close
Set objRec=Nothing
Set objCon=Nothing
'Msgbox "Executed Sucessfully"