Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Location
    Hanoi
    Posts
    4,306

    ASPX ODBC connection error???

    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.

    Code:
    <%@ Page Language="VB" ContentType="text/html" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.ODBC" %>
    
    <script runat="server">
    
    Sub Page_Load(Source as Object, E as EventArgs)
           If Not Page.IsPostBack Then
            BindData
           End If
        End Sub
    
    Sub BindData()
    
        Dim myConnection As String
        If myConnection = "" Then
            myConnection = "dsn=db;"
        End If
        Dim myConn As New OdbcConnection(myConnection)
        Dim myQuery As String = "Select * from tblDSLOP"
        Dim myOdbcCommand As New OdbcCommand(myQuery)
        myOdbcCommand.Connection = myConn
        myConn.Open()
        myOdbcCommand.ExecuteNonQuery()
        MsgBox("Connected")
        myOdbcCommand.Connection.Close()     
    End Sub
    </script>
    <html>
    <head>
        <title>Testing</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>
    <body>
        <b><font face="Tahoma" size="2">
        <div id="outError" runat="server">
        </div>
        <p>&nbsp;</p>
    </body>
    </html>

    Source Error:

    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")


    Is there anyone please help? Thanks

  2. #2
    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! )

  3. #3
    Join Date
    Oct 2003
    Location
    Hanoi
    Posts
    4,306
    Well... regarding the database: I can use ASP 3.0 connect it without any problem. Just have issue with .NET

    also checked the TEMP folder. My provider said that it's writable with everyone, even with guest.

    any other idea?

  4. #4
    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'...

    Sorry I couldn't help ya on this one.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •