Func _Md_main($Mdb_path,$Disk_code)
$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 main")
$addTbl.Execute("CREATE TABLE reginfo")
$addtbl.Close
;建字段
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $Mdb_path )
$addfld.Execute("ALTER TABLE main ADD id identity(1, 1) primary key,mname String,dbname String,dbpass String")
$addfld.Execute("ALTER TABLE reginfo ADD id identity(1, 1) primary key,regname String,pccode String,regcode String")
$addfld.Execute("Insert Into reginfo (regname,pccode,regcode) VALUES('同标网络科技','"&$Disk_code&"','0')")
$addfld.Close
_log2($Main_path,'新建"Main"数据库完成')
EndFunc
|