用ASP打开远端MDB文件的方法

时间:2008-10-07 12:04:38  来源:第二电脑网上收集  作者:

  第二电脑网导读:oft Access Driver] The Microsoft Jet database engine cannot open the file ’(unknown)’. It is already opened exclusively by another user, or you need permission to view its data.     你完全可以避免这种错误--ASP和ActiveX支持两种方式打开MDB文件的DSN-less连接,或由其它机器访问MDB文件。     1. DAO database (only for small loa...
  正文:

  如果你用ODBC connection (DSN or DSN-less)来访问远端的(UNC path)数据库, OLEDB会出现以下错误信息:  

  Microsoft OLE DB Provider for ODBC Drivers error ’80004005’   

  [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file ’(unknown)’. It is already opened exclusively by another user, or you need permission to view its data.  

  你完全可以避免这种错误--ASP/ target=_blank class=infotextkey>asp和ActiveX支持两种方式打开MDB文件的DSN-less连接,或由其它机器访问MDB文件。  


  1. DAO database (only for small load)   

  Dim File, Conn, RS  

  Const ReadOnly = False  

  File = "//server/share/file.mdb"  

  Set Conn = CreateObject("DAO.DBEngine.35").Workspaces(0).OpenDatabase(File,,ReadOnly)

  Set RS = Conn.OpenRecordset(SQL)   

  2. ADO + Jet OLE DB provider  

  Dim Conn, RS  

  Set Conn = CreateObject("ADODB.Connection")  

  Conn.Provider = "Microsoft.Jet.OLEDB.4.0"  

  Conn.Open "//server/share/file.mdb"  

  Set RS = Conn.Execute(SQL)   


  你得确定使用ASP的用户有NT的数据库及共享访问权限。   

  假定有权限的话,你亦可访问其它机器中的开放数据连接:   

  

  http://www.photoshop/ target=_blank class=infotextkey>pstruh.cz/  

  Set UM = CreateObject("UserManager.Server")   

  UM.LogonUser "Login with the rights", "Password", "Domain"

  ...  

  open database  

  ...   

  UM.RevertToSelf   

"用ASP打开远端MDB文件的方法"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/ASP/2008-10-07/2938.html


关键字:

关于《用ASP打开远端MDB文件的方法》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td