I am running a test page on WIndows 2003 server, and met error
Server Error in '/' Application.
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] Disk or network error. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] Disk or network error.
after searching, I could not find out the solution Is there anyone can help?
This is the code file.
<%@ Page Language="VB" ContentType="text/html" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ODBC" %>
Sub Page_Load(Source as Object, E as EventArgs)
If Not Page.IsPostBack Then
Dim myConnection As String
If myConnection = "" Then
myConnection = "dsn=db;"
Dim myConn As New OdbcConnection(myConnection)
Dim myQuery As String = "Select * from tblDSLOP"
Dim myOdbcCommand As New OdbcCommand(myQuery)
myOdbcCommand.Connection = myConn
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<b><font face="Tahoma" size="2">
<div id="outError" runat="server">
Line 19: Dim myOdbcCommand As New OdbcCommand(myQuery)
Line 20: myOdbcCommand.Connection = myConn
Line 21: myConn.Open()
Line 22: myOdbcCommand.ExecuteNonQuery()
Line 23: MsgBox("Connected")
Double check the file path to the Access database and that the database itself isn't corrupt. Then make sure the ASP.NET account has permissions to read the file.
Also, Microsoft has some info regarding the TEMP folder and permissions for connecting to Access via ODBC: KB Article Q251254. (I woud've post the URL, but the forum software won't let me...not enough posts! )
Hmm...I tried your code on both a Win2K3 machine and a Win2K machine and successfully connected to the database without any problems. I tried tweaking the permissions in an attempt to break it, but I couldn't produce the "disk or network error" message.
Have you tried creating an empty Access database and testing the ODBC connection against it? Is the hard drive full? Or if its a shared server, have you maxed out your allotted space?
Might try reinstalling MDAC, service packs, etc--but I'm now I'm just graspin'...