SQLITE如果要使用ODBC,连接字符串是什么格式呀? [已解决]
本帖最后由 xtanxin 于 2011-5-28 00:40 编辑能否写一下,用ADO建立连接,操作SQLITE数据库的例子?
查了一晚上了.都是本地的使用SQLITE
楼下哥们,你那个是mdb的,终于摸索和搜索出来了.我对数据库纯属于一窍不通的.Global $DataSoucename="BZ"
Global $DBserverIP="192.168.1.150" $conn = ObjCreate("ADODB.Connection") ;首先要建立ADODB.Connection类
If $conn.State = "AdStateOpen" Then
WLog("数据库连接成功:"&$DBserverIP&", "&$DataSoucename)
Return $conn
Else
WLog("数据库连接失败:"&$DBserverIP&", "&$DataSoucename)
EndIf$conn.Open ("DRIVER={SQLite3 ODBC Driver};server="&$DBserverIP&";Data Source="&$DataSoucename)头大就是这最后一句上面了.找的我累死.不懂ADO好吃亏呀. 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 学习了,谢谢
页:
[1]