Option Explicit Public MdbConn As New ADODB.Connection'功能简介:建立本地数据库公共链接 '参数一:MDB数据库地址路径 '返回值:"ok"--成功 Function PulbicMdbConn(ByVal StrPath As String) As String On Error GoTo MdbConnErr Dim StrSql As String StrSql = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & StrPath & ";Persist Security Info=False" If MdbConn.State <> 0 Then MdbConn.Close MdbConn.Open StrSql PulbicMdbConn = "ok" Exit Function MdbConnErr: PulbicMdbConn = Err.Description If MdbConn.State <> 0 Then MdbConn.Close: Set MdbConn = Nothing End Function'功能简介:关闭本地数据库公共链接 Function PublicMdbClose() If MdbConn.State <> 0 Then MdbConn.Close: Set MdbConn = Nothing End Function上面的路径你写网络路径,如:\\192.168.0.1\C$\Data\myAccess.mdb 意思是你的ACCESS数据库为192.168.0.1这台机器上的盘Date目录下
可是这个好象是局域网内的吧,我想要internet网的远程链接啊,呵呵
同意周松 Data Source=ip\\path\test.mdb 只要把ip地址加进去就可以了
以下是连接字符串:MS Remote - Access (Jet) If you want to use an ODBC DSN on the remote machineoConn.Open "Provider=MS Remote;" & _ "Remote Server=http://myServerName;" & _ "Remote Provider=MSDASQL;" & _ "DSN=AdvWorks;" & _ "Uid=myUsername;" & _ "Pwd=myPassword"
If you want to use an OLE DB Provider on the remote machineoConn.Open "Provider=MS Remote;" & _ "Remote Server=http://myServerName;" & _ "Remote Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=c:\somepath\mydb.mdb", _ "admin", ""
If you want to use an OLE DB Provider on the remote machineoConn.Open "Provider=MS Remote;" & _ "Remote Server=http://myServerName;" & _ "Handler=MSDFMAP.Handler;" & _ "Data Source=MyAdvworksConn" The corresponding entry in the \winnt\Msdfmap.ini file would be:[connect MyAdvworksConn] Access = ReadWrite Connect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=mydb.mdb; User Id=admin; Password=" (put all of this on single line!)
还是不行啊,55……,报错说实时错误‘8447’,internet服务器错误
MS_ACCESS_MDB的远程连接的教材或例子都是基于局域网的(我从来就没找着过基于internet网的,要知道internet的环境有多糟糕),如果你确是要在internet上远程访问的话,建议你还是使用sql server做数据库吧,远程安装sql server 服务器端,本地客户端安装sql server client.to:fling_boy(andy--天意)(冰狱绝剑) :如果使用http://x.x.x.x做为服务器地址引用的话,是否存在不安全因素?因为http://表明了使用http协议,而http协议是占用80端口,而传输的数据是文本型数据(基本可认为是明文传输)的。
Public MdbConn As New ADODB.Connection'功能简介:建立本地数据库公共链接
'参数一:MDB数据库地址路径
'返回值:"ok"--成功
Function PulbicMdbConn(ByVal StrPath As String) As String
On Error GoTo MdbConnErr
Dim StrSql As String
StrSql = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & StrPath & ";Persist Security Info=False"
If MdbConn.State <> 0 Then MdbConn.Close
MdbConn.Open StrSql
PulbicMdbConn = "ok"
Exit Function
MdbConnErr:
PulbicMdbConn = Err.Description
If MdbConn.State <> 0 Then MdbConn.Close: Set MdbConn = Nothing
End Function'功能简介:关闭本地数据库公共链接
Function PublicMdbClose()
If MdbConn.State <> 0 Then MdbConn.Close: Set MdbConn = Nothing
End Function上面的路径你写网络路径,如:\\192.168.0.1\C$\Data\myAccess.mdb
意思是你的ACCESS数据库为192.168.0.1这台机器上的盘Date目录下
Data Source=ip\\path\test.mdb
只要把ip地址加进去就可以了
If you want to use an ODBC DSN on the remote machineoConn.Open "Provider=MS Remote;" & _
"Remote Server=http://myServerName;" & _
"Remote Provider=MSDASQL;" & _
"DSN=AdvWorks;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
If you want to use an OLE DB Provider on the remote machineoConn.Open "Provider=MS Remote;" & _
"Remote Server=http://myServerName;" & _
"Remote Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb", _
"admin", ""
If you want to use an OLE DB Provider on the remote machineoConn.Open "Provider=MS Remote;" & _
"Remote Server=http://myServerName;" & _
"Handler=MSDFMAP.Handler;" & _
"Data Source=MyAdvworksConn"
The corresponding entry in the \winnt\Msdfmap.ini file would be:[connect MyAdvworksConn]
Access = ReadWrite
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=mydb.mdb;
User Id=admin;
Password=" (put all of this on single line!)