Global $MyError = ObjEvent('AutoIt.Error', 'MyErrFunc')
$mdb=@ScriptDir&"\数据库文件.mdb"
$Database=@ScriptDir&"\MDW文件.MDW"
$userid="datamaintain"
$userPassword="wxwgisyigfzlsndcscp"
$mdbpwd="zhrmghg1949jgqz"
$sCardID= Random(1, 10000000, 1)
$k="0"
$cRemain="¥10.00"
$sType="计费卡"
$sCardType="身份证"
$dtTime="2010-09-27 17:24:37"
$iState="0"
$T="*"
$tblname="tTmpCard"
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;User ID="&$userid&";Password="&$userPassword&";Data Source="&$mdb&";Persist Security Info=False;Jet OLEDB:System Database="&$Database&";Jet Oledb:Database Password="&$mdbpwd)
Local $Records = ObjCreate("ADODB.Recordset")
$Records.ActiveConnection = $addfld
$Records.Open('Select * From tTmpCard')
While Not $Records.eof And Not $Records.bof
MsgBox(4096, '', $Records.fields(0).value)
$Records.movenext
WEnd
$Text = "insert into tTmpCard (sCardID,sIDCard,sMemo,cRemain,sType,iRest,sCardType,sName,dtTime,iState,sfixOpt,sPwd) values("&$sCardID&","&$k&","&$k&",'"&$cRemain&"','"&$sType&"',"&$k&",'"&$sCardType&"',"&$k&",'"&$dtTime&"',"&$iState&","&$k&","&$k&")"
MsgBox(4096, '', $Text)
$addfld.Execute($Text)
$Records.Close
$addfld.close
MsgBox(4096, "提示:","成功写入数据库!")
Func MyErrFunc()
$i = '----> COM Error Encountered in ' & @ScriptName & @CR & _
'----> $ErrorScriptline = ' & $MyError.scriptline & @CR & _
'----> $ErrorNumberHex = ' & Hex($MyError.number, 8) & @CR & _
'----> $ErrorNumber = ' & $MyError.number & @CR & _
'----> $ErrorWinDescription = ' & StringStripWS($MyError.WinDescription, 2) & @CR & _
'----> $ErrorDescription = ' & StringStripWS($MyError.description, 2) & @CR & _
'----> $ErrorSource = ' & $MyError.Source & @CR & _
'----> $ErrorHelpFile = ' & $MyError.HelpFile & @CR & _
'----> $ErrorHelpContext = ' & $MyError.HelpContext & @CR & _
'----> $ErrorLastDllError = ' & $MyError.LastDllError
MsgBox(4096, ClipPut($i), $i)
Exit
EndFunc
|