有人可以帮忙解释下下面用AutoIt操作access数据库的例子每行的作用吗?
有人可以帮忙解释下下面用AutoIt操作access数据库的例子每行的作用吗?我看了很久都不清楚是什么意思。。。代码:
--------------------------------------------------------------------------------
$db>$tbl>$fld>$format="int"
$sData="123456"
$T="*"
_CreateDB($dbname)
_CreateTBL($dbname,$tblname)
_CreateFLD($dbname,$tblname,$fldname,$format)
;_InsertData($dbname,$tblname,$fldname,$sData)
;_DeleteData($dbname,$tblname,$fldname,$sData)
_SelectData($dbname,$tblname,$fldname,$T)
Func_CreateDB($dbname)
$newMdb=ObjCreate("ADOX.Catalog")
$newMdb.Create("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&$dbname)
$newmdb.ActiveConnection.Close
EndFunc
Func_CreateTBL($dbname,$tblname)
$addtbl=ObjCreate("ADODB.Connection")
$addTbl.Open("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&$dbname)
$addTbl.Execute("CREATETABLE"&$tblname)
$addtbl.Close
EndFunc
Func_CreateFLD($dbname,$tblname,$fldname,$format)
$addfld=ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&$dbname)
$addfld.Execute("ALTERTABLE"&$tblname&"ADD"&$fldname&""&$format)
$addfld.Close
EndFunc
Func_InsertData($dbname,$tblname,$fldname,$sData)
$addfld=ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&$dbname)
$addfld.Execute("InsertInto"&$tblname&"("&$fldname&")"&"VALUES("&$sData&")")
$addfld.Close
EndFunc
Func_DeleteData($dbname,$tblname,$fldname,$sData)
$addfld=ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&$dbname)
$addfld.Execute("DeleteFrom"&$tblname&"Where"&$fldname&"="&$sData)
$addfld.Close
EndFunc
Func_SelectData($dbname,$tblname,$fldname,$T)
$addfld=ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;DataSource="&$dbname)
$RS=ObjCreate("ADODB.Recordset")
$RS.ActiveConnection=$addfld
$RS.Open ("Select"&$T&"From"&$tblname)
msgbox(0,"",$RS.Fields(0).Name)
msgbox(0,"",$RS.Fields(0).Value)
$addfld.Close
EndFunc
whilenot$rs.eofandnot$rs.bof
if@error=1ThenExitLoop
$tempData=$tempData&($RS.Fields("value").Value)&"|"
$rs.movenext
WEnd 有人会解释下吗????? ????????????????????? 开里面的说明就可以领略了
页:
[1]