Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database connection.
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi Friends,
I am trying to connect to a Database and importing Database Data to runtime databale.
But i am getting following error
The test run cannot continue due to a syntax error.
Expected 'Loop'
Line (28): "".

My script is as below

Code:
dim con,rs
set con=createobject("adodb.connection")
set rs=createobject("adodb.recordset")
con.open"provider=sqloledb.1;server=xyz;uid=sa;pwd=sa@123;database=First"
rs.open"select * from employee",con
do while not rs.eof
datatable.getsheet(1).addparameter"Eid",""
datatable.getsheet(1).addparameter"EName",""
datatable.getsheet(1).addparameter"Salary",""
datatable.getsheet(1).addparameter"DID",""
row=1
do while not rs.EOF
databale.setcurrentrow(row)
datatable.value(1,1)=rs.fields("Eid")
datatable.value(2,1)=rs.fields("EName")
datatable.value(3,1)=rs.fields("Salary")
datatable.value(1,1)=rs.fields("DID")
row=row+1
rs.movenext
Loop

can any one point the issue.

Thnks in advance
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
Code:
[b]do while not rs.eof[/b]
datatable.getsheet(1).addparameter"Eid",""
datatable.getsheet(1).addparameter"EName",""
datatable.getsheet(1).addparameter"Salary",""
datatable.getsheet(1).addparameter"DID",""
row=1
[b]do while not rs.EOF[/b]

You are starting 2 loops but ending only one
Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
Ohhh Yes yes....

and it runs...

thnks
Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
Code:
Set dtNewSheet=DataTable.AddSheet( "mysheet" )
set stNewCol1=dtNewSheet.addparameter("col1","" )
set stNewCol2=dtNewSheet.addparameter("col2","" )
set stNewCol3=dtNewSheet.addparameter("col3","" )

set conn5=Createobject( "ADODB.Connection")
Srvname5="Driver= {Microsoft ODBC forOracle}:Server= DBserver, UID=Sa,Password= sa"
conn5.open "provider=sqloledb.1;server=xyz;uid=sa;pwd=sa@123;database=First"
Set Rec5 = CreateObject("ADODB.Recordset")
SQL5="select * from employee  "
Set Rec5 = conn5.execute( SQL5)
j=1
While not rec5.eof
unit=Rec5.fields("route_seq")
=Rec5.fields("id")
procesc=Rec5.fields("process")
                                    
stNewCol1.valuebyrow (j)=majprod
stNewCol2.valuebyrow (j)=orderid
stNewCol3.valuebyrow (j)=header
j=j+1
Rec5.movenext
Wend
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT] Connection String for Oracle robertosalemi 6 12,355 01-15-2016, 04:51 PM
Last Post: robertosalemi
  DB2 Connect connection with IE 11 SRP 1 2,648 12-18-2015, 12:41 PM
Last Post: vinod123
  IBM DB2 connection with VB script bmurali 2 10,974 12-18-2015, 12:38 PM
Last Post: vinod123
  Connection with HP ALM hachem 0 2,659 02-26-2015, 04:36 PM
Last Post: hachem
  “Cannot connect to 8822 (connection timed out)" Ikbal 0 2,180 12-08-2014, 11:38 PM
Last Post: Ikbal

Forum Jump:


Users browsing this thread: 1 Guest(s)