如何连接本地ACCESS数据库? 如何连接本地ACCESS数据库? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Password='';Data Source=" _ & App.Path & "\数据库.mdb;Persist Security Info=True" GlCn.ConnectionString = ConStr GlCn.CursorLocation = adUseClient GlCn.Open Dim rstTemp As New ADODB.Recordset rstTemp.ActiveConnection = GlCn rstTemp.CursorLocation = adUseClient rstTemp.CursorType = adOpenDynamic rstTemp.LockType = adLockReadOnly rstTemp.Source = "SELECT * FROM 表名" rstTemp.Open 老兄,那么,怎么连接另一台机子的access,要不要装客户端? Dim cn As New ADODB.Connectioncn.Open "provider=microsoft.jet.oledb.4.0;data source=c:\db.mdb" 把access数据库放在程序当前目录下,用相对路径app.path工程--->引用--->Microsoft ActiveX Data Object 2.x(版本号) Dim CN As New ADODB.Connection '定义数据库的连接 Dim Rs As New ADODB.Recordset CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\student.mdb" CN.Open Rs.CursorLocation = adUseClient Rs.Open "select * from employees", CN, adOpenDynamic, adLockOptimistic MsgBox Rs.Fields(0) 请问楼上,怎么连接另一台机子的access,要不要装客户端? 像楼上的各位说的用程序动态写,把连接字符串放到模块中,各窗体只要引用这个字符串就行。如果要访问另一台计算机的access数据库,先把数据库所在的文件夹设成共享,可以配置odbc数据源,利用网络邻居指向你要连的access库就行。 问:为什么我用以下连接数据库并查询后, cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\mydb.mdb;Persist Security Info=False" cn.ConnectionTimeout = 30 cn.Open rs.Open "author", cn, adOpenKeyset, adLockOptimistic, adCmdTable rs.Close再用以下查询就会报错:article给锁定了 rs.Open "select * from article", cn, adOpenKeyset, adLockOptimistic, adCmdTable 把这句"rs.Close"先删去试试看 请参考http://expert.csdn.net/Expert/topic/2710/2710006.xml?temp=8.526248E-02 请各位高手帮忙解决一下这个小问题。百分送上! 怎么判断对方是否在线上,或者自己是否可以与对方建立连接 picture 我想将"'"号插入数据库,怎么办? 如何用身份证判断年纪~!(在线等待) 如何通過網絡中的計算機名得到其IP地址。 如何生成这些时间啊? 9针的,232串口(电脑向投影机发码)开、关和切换视频信号 如何控制控件的显示层次! 怎样能够最简单的执行写好的SQL语句? 连接本地的ACCESS数据库 关于ADO数据库连接的问题
ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Password='';Data Source=" _
& App.Path & "\数据库.mdb;Persist Security Info=True"
GlCn.ConnectionString = ConStr
GlCn.CursorLocation = adUseClient
GlCn.Open
Dim rstTemp As New ADODB.Recordset
rstTemp.ActiveConnection = GlCn
rstTemp.CursorLocation = adUseClient
rstTemp.CursorType = adOpenDynamic
rstTemp.LockType = adLockReadOnly
rstTemp.Source = "SELECT * FROM 表名"
rstTemp.Open
cn.Open "provider=microsoft.jet.oledb.4.0;data source=c:\db.mdb"
工程--->引用--->Microsoft ActiveX Data Object 2.x(版本号) Dim CN As New ADODB.Connection '定义数据库的连接
Dim Rs As New ADODB.Recordset CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & App.Path & "\student.mdb" CN.Open
Rs.CursorLocation = adUseClient
Rs.Open "select * from employees", CN, adOpenDynamic, adLockOptimistic MsgBox Rs.Fields(0)
如果要访问另一台计算机的access数据库,先把数据库所在的文件夹设成共享,可以配置odbc数据源,利用网络邻居指向你要连的access库就行。
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\mydb.mdb;Persist Security Info=False"
cn.ConnectionTimeout = 30
cn.Open
rs.Open "author", cn, adOpenKeyset, adLockOptimistic, adCmdTable
rs.Close再用以下查询就会报错:article给锁定了
rs.Open "select * from article", cn, adOpenKeyset, adLockOptimistic, adCmdTable
把这句"rs.Close"先删去试试看
http://expert.csdn.net/Expert/topic/2710/2710006.xml?temp=8.526248E-02