从远程SQL Server更新本地Access表,主要代码如下:
ConnStr = "Provider=SQLOLEDB;Data Source=" & DataSource & ";Uid=sa;Pwd=123;Database=test"Dim ConnLocal As New ADODB.Connection
Dim ConnTemp As New ADODB.Connection
ConnTemp.Open ConnStr
If Err.Number <> 0 Then
MsgBox "打开数据库错误:" & Err.Description
ConnTemp.Close
Set ConnTemp = Nothing
Exit Sub
Else
ConnLocal.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};Uid=Admin;Pwd=aclemedia;Dbq=" & App.Path & "\Library\test.mdb;"
ConnLocal.Open
ConnLocal.Execute "Delete from Ad"
ConnLocal.Execute "Delete from MSys"
ConnLocal.Execute "Delete from news "
ConnLocal.Execute "Delete from UserAdmin"
ConnLocal.Close
Set ConnLocal = Nothing
strSql = "Insert into OpenDataSource( 'Microsoft.Jet.OLEDB.3.51','Data Source=" & App.Path & "\Library\test.mdb')..."
ConnTemp.Execute (strSql & "news(newsid, newsname, TypeId, adddate, Author) select newsid, newsname, TypeId, adddate, Author from news")
ConnTemp.Execute (strSql & "Ad(ID , OrderID, Title, Intro, FileType, FilePath, AddDate) select ID , OrderID, Title, Intro, FileType, FilePath, AddDate from Ad")
ConnTemp.Execute (strSql & "MSys(ID,PlayAd,TimeOut,bgmusic) select ID,PlayAd,TimeOut,bgmusic from Msys")
ConnTemp.Execute (strSql & "UserAdmin(ID,userid,userpwd,RealName,IsSuper,Permit,Intro,RegDate) select ID,userid,userpwd,RealName,IsSuper,Permit,Intro,RegDate from UserAdmin")
ConnTemp.Close
Set ConnTemp = Nothing
If Err.Number <> 0 Then
MsgBox "执行更新错误:" & Err.Description
Exit Sub
Else
MsgBox "更新成功!"
End If
End If
我在我的本机上测试没有问题,但到了客户到网络中就出了这个问题,MDAC2.0也下载了一个装了,我在注册表HKEY_CLASS_ROOT下也找到了Microsoft.JET.OLEDB.3.51 ,可是还是有这个提示,请问是什么原因,如何解决问题? 这几天弄得头都大了,还是没有找到好的解决办法,希望能够论坛兄弟的帮助,非常感谢!!!
ConnStr = "Provider=SQLOLEDB;Data Source=" & DataSource & ";Uid=sa;Pwd=123;Database=test"Dim ConnLocal As New ADODB.Connection
Dim ConnTemp As New ADODB.Connection
ConnTemp.Open ConnStr
If Err.Number <> 0 Then
MsgBox "打开数据库错误:" & Err.Description
ConnTemp.Close
Set ConnTemp = Nothing
Exit Sub
Else
ConnLocal.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};Uid=Admin;Pwd=aclemedia;Dbq=" & App.Path & "\Library\test.mdb;"
ConnLocal.Open
ConnLocal.Execute "Delete from Ad"
ConnLocal.Execute "Delete from MSys"
ConnLocal.Execute "Delete from news "
ConnLocal.Execute "Delete from UserAdmin"
ConnLocal.Close
Set ConnLocal = Nothing
strSql = "Insert into OpenDataSource( 'Microsoft.Jet.OLEDB.3.51','Data Source=" & App.Path & "\Library\test.mdb')..."
ConnTemp.Execute (strSql & "news(newsid, newsname, TypeId, adddate, Author) select newsid, newsname, TypeId, adddate, Author from news")
ConnTemp.Execute (strSql & "Ad(ID , OrderID, Title, Intro, FileType, FilePath, AddDate) select ID , OrderID, Title, Intro, FileType, FilePath, AddDate from Ad")
ConnTemp.Execute (strSql & "MSys(ID,PlayAd,TimeOut,bgmusic) select ID,PlayAd,TimeOut,bgmusic from Msys")
ConnTemp.Execute (strSql & "UserAdmin(ID,userid,userpwd,RealName,IsSuper,Permit,Intro,RegDate) select ID,userid,userpwd,RealName,IsSuper,Permit,Intro,RegDate from UserAdmin")
ConnTemp.Close
Set ConnTemp = Nothing
If Err.Number <> 0 Then
MsgBox "执行更新错误:" & Err.Description
Exit Sub
Else
MsgBox "更新成功!"
End If
End If
我在我的本机上测试没有问题,但到了客户到网络中就出了这个问题,MDAC2.0也下载了一个装了,我在注册表HKEY_CLASS_ROOT下也找到了Microsoft.JET.OLEDB.3.51 ,可是还是有这个提示,请问是什么原因,如何解决问题? 这几天弄得头都大了,还是没有找到好的解决办法,希望能够论坛兄弟的帮助,非常感谢!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货