|
请问在access数据库中怎样能同时建立多个table表呢
我这样写程序报错,希望高手指教!
Func _Data_Create($mdb_path)
$newMdb = ObjCreate("ADOX.Catalog")
$newMdb.Create("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_path)
$newmdb.ActiveConnection.Close;建数据库
$addtbl = ObjCreate("ADODB.Connection")
$addTbl.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_path)
$addTbl.Execute("CREATE TABLE Room")
$addTbl.Execute("CREATE TABLE User")
$addtbl.Close;建表
$Conn = ObjCreate("ADODB.Connection")
$Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_path)
$Conn.Execute("ALTER TABLE Room ADD id identity(1, 1) primary key,Num int,Name varchar")
$Conn.Execute("ALTER TABLE User ADD id identity(1, 1) primary key,Desc varchar,Name varchar,Pass varchar")
$Conn.Close;建列表名
EndFunc |
|