|
1.下面是我参照一些资料,想在订票系统中修改订票内容,修改内容分别为为数据库表中的两个字段(名字和票数),脚本是这样的:
Window("Flight Reservation").Activate
Window("Flight Reservation").WinRadioButton("Economy").Set
Dim Objconn
Dim Rst
Objku="d:\data.mdb"
Set Objconn=Createobject("adodb.connection")
Objconn.open ="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Objku
Set Rst =CreateObject("ADODB.Recordset")
Rst.open "select * from flight",Objconn,1,1
rst.movefirst
Const ForReading = 1, ForAppending = 8
Dim i,j
Dim fso
Dim f
Dim ts
Dim TextStreamTest
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile "d:/NAME.txt"
Set f = fso.GetFile("d:/NAME.txt")
Do while Rst.EOF <> True
i=Rst.Fields("name")
j=Rst.Fields("tickets")
print i
print j
Set ts = f.OpenAsTextStream(ForAppending, TristateUseDefault)
rst.movenext
ts.Writeline i
ts.Writeline j
Window("Flight Reservation").WinEdit("Name:").SetSelection 0,10
Window("Flight Reservation").WinEdit("Name:").Set i
Window("Flight Reservation").WinEdit("Tickets:").Set j
Window("Flight Reservation").WinButton("Update Order").Click
Window("Flight Reservation").Activate
ts.Close
Loop
rst.close
Objconn.close
set rst=nothing
Set Objconn=Nothing
2.数据表flight的两个字段及内容为
name tickets
内容 aaa 2
bbb 1
我想把数据库里表flight表中name,tickets读到脚本中,但是执行到Rst.open "select * from flight",Objconn,1,1时报错如下:
至少一个参数没有被指定。
这段脚本的有些语句,我基本上是粘贴复用的,所以想请教%B |
|