strapp=app.path 是获得当前系统的路径,
在你引用的时候必须保证当前路径下有“db1.mdb”文件!!!
我理解你的
If Right(strapp, 1) <> "\" Then
strapp = strapp + "\"
End If
的意思
但是,最好是用commondialog获得FileName
然后替换strapp & "db1.mdb"代码!
在你引用的时候必须保证当前路径下有“db1.mdb”文件!!!
我理解你的
If Right(strapp, 1) <> "\" Then
strapp = strapp + "\"
End If
的意思
但是,最好是用commondialog获得FileName
然后替换strapp & "db1.mdb"代码!
如果用commondialog选择数据库,那么余下的如何操作??
然后直接放置CommonDialog控件
用CommonDialog.ShowOpen之后可以返回Commondialog.FileName
在引用就可以了!!!
Connection1.Connectionsource = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & strapp & "db1.mdb" '错误:要求对像
替换成
Connection1.Connectionsource = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & CommonDialog.filename '错误:要求对像
同时保证真的有数据库文件打开了!就是commonDialog.Filename<>""
且commondialog.DefaultExt =“.MDB”
云兄,我后面的那个“'错误:要求对像”是我加上的,程序在这儿出错,要求对像,我加上对像DataEnvironment1.Connection1.Connectionsource = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & strapp & "db1.mdb"后,说是对像不支持命名参数!
你把
Connection1.Connectionsource = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & strapp & "db1.mdb" '错误:要求对像
改为
Connection1.Connectionstring= "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & strapp & "db1.mdb" '错误:要求对像
看看行不行。
首先要引用
dim connection1 as new adodb.connection
谢谢。可能和你的有误。