高手们,来顶一顶拉...
正在想用AutoIT 操作ACCESS, 碰到了一些问题,以下的代码是实现想数据里插入数据, 如果插入一条记录就成功了,问题是如果向表里插入两条甚至两条以上的数据却无法实现,想请大家提供一下正确的语句.
$dbname="C:\Temp\SignMe.mdb"
$tblname="SignUp"
$fld1="ID"
$fld2="PSW"
_InsertData($dbname,$tblname,$fld1,$fld2,InputBox("ID","Please Input your ID:"),InputBox("PSW","And Password Please:"))
Func _InsertData($dbname,$tblname,$fld1,$fld2,$sData1,$sData2)
$addfld=ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& $dbname)
$addfld.Execute("Insert Into " & $tblname & "(" & $fld1 & ")" & "VALUES(" & $sData1 &")") ; 一条记录, 已成功
$addfld.Execute("Insert Into " & $tblname & "(" & $fld1 & ")" & "VALUES(" & $sData1 &") And " & $tblname & "(" & $fld2 & ")" & "VALUES(" & $sData2 &")"); 2条记录, 通过不了
$addfld.Close
EndFunc
在线等待中...
[ 本帖最后由 Rota 于 2008-5-6 17:20 编辑 ] |