Re: Intermittant Server Error reading an MS Access DB

From: Chuck Ritzke (CHUCK)
Date: 04/24/04


Date: Sat, 24 Apr 2004 00:12:58 -0500

Hello again,

I narrowed down where the error occurs by writing to a trace file. Below is
my code that builds the data adapter and attempts to fill the dataset. When
the error occurs, it occurs the first time at the DATAADAPTER.FILL line in
the FOR NEXT loop. Again, the error occurs seemingly randomly. Anybody see
anything wrong that might cause the error to occur upon occasion and what I
should do to keep it from happening???

Thanks again,
Chuck

'===========================================
Private Sub GetDataSet_ODBC(ByVal dsDataSet As DataSet)

    Dim DataAdapter As New System.Data.Odbc.OdbcDataAdapter
    Dim i As Integer
    Dim iUBound As Integer
    DataAdapter.SelectCommand = New System.Data.Odbc.OdbcCommand

    With DataAdapter.SelectCommand
        .CommandType = CommandType.StoredProcedure
        .Connection = New System.Data.Odbc.OdbcConnection
        .Connection.ConnectionTimeout = 15
        .Connection.ConnectionString = "Driver={Microsoft Access Driver
(*.mdb)};" & _
        "DBQ=" & tDBPath & tDBName & ";UID=;PWD=" & tDBPassword
    End With
    DataAdapter.InsertCommand = New System.Data.Odbc.OdbcCommand
    With DataAdapter.InsertCommand
        .CommandType = CommandType.StoredProcedure
        .Connection = DataAdapter.SelectCommand.Connection
    End With
    DataAdapter.SelectCommand.Connection.Open()
    iUBound = UBound(usrProcedures)

    For i = 0 To iUBound

        DataAdapter.SelectCommand.CommandText = "Execute " &
usrProcedures(i).tName & " " & usrProcedures(i).tParameters

        If Me.bWriteToTraceFile Then Me.WriteToTextFile(" Executing... " &
usrProcedures(i).tName, System.AppDomain.CurrentDomain.BaseDirectory &
"..\TraceFiles\TraceODBC.txt", True)

        DataAdapter.Fill(dsDataSet, usrProcedures(i).tTableName)

        If Me.bWriteToTraceFile Then Me.WriteToTextFile(" Wrote to " &
usrProcedures(i).tTableName, System.AppDomain.CurrentDomain.BaseDirectory &
"..\TraceFiles\TraceODBC.txt", True)

    Next
    DataAdapter.SelectCommand.Connection.Close()
    DataAdapter = Nothing

End Sub
'===========================================

"Chuck Ritzke" <CHUCK AT MYACTUARY DOT COM> wrote in message
news:eizWwnIKEHA.2680@TK2MSFTNGP11.phx.gbl...
> Hi all,
>
> I am getting an intermittant error after uploading a project from my
> development machine. I click on a link which opens an aspx page that, upon
> page load, reads a very small amount of data from an MS Access database,
> using ODBC and a stored query. There is no problem on my development
> machine. On the production server though, I get the intermittant error
shown
> below. If I click back and forth between the problem page and the linking
> page, the error only occurs every 6th (or so) times I click on the link.
> When I do get the error, the page works fine if I page back and click
again,
> or if I just re-load the page (until it happens again later). I read the
DB
> in other parts of the project and have not seen the problem anywhere else
> yet.
>
> This is my first .NET project and so I may be missing something obvious.
Can
> anybody tell me where I should look for this problem or what might be
> causing it? I don't really understand how to use the stack info provided.
Is
> it some type of timing or "database not ready" thing that I need to
handle?
> (I've read lots of DBs in regular ASP and have had no problem like this).
> Should I be trying to Catch this error somewhere (where?).
>
> TIA,
> Chuck
> Server Error in '/HistoricGrowth' Application.
> --------------------------------------------------------------------------

--
> ----
>
> ERROR [22018] [Microsoft][ODBC Microsoft Access Driver] Unknown name
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.Data.Odbc.OdbcException: ERROR [22018]
> [Microsoft][ODBC Microsoft Access Driver] Unknown name
>
> Source Error:
>
>
>       An unhandled exception was generated during the execution of the
> current web request. Information regarding the origin and location of the
> exception can be identified using the exception stack trace below.
>
>
> Stack Trace:
>
>
> [OdbcException: ERROR [22018] [Microsoft][ODBC Microsoft Access Driver]
> Unknown name]
>    System.Data.Odbc.OdbcConnection.HandleError(HandleRef hrHandle,
> SQL_HANDLE hType, RETCODE retcode) +32
>    System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior
> behavior, String method) +1189
>    System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
+48
>
>
System.Data.Odbc.OdbcCommand.System.Data.IDbCommand.ExecuteReader(CommandBeh
> avior behavior) +5
>    System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
> startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
> CommandBehavior behavior) +304
>    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord,
> Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior
> behavior) +77
>    System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
> +36
>    clsUtil_MyDB.MyDB.GetDataSet_ODBC(DataSet dsDataSet) +556
>    clsUtil_MyDB.MyDB.GetDataSet(DataSet dsDataSet) +22
>    HistoricGrowth.HistoricGrowth.InitializePageControls() +386
>    HistoricGrowth.HistoricGrowth.Page_Load(Object sender, EventArgs e) +51
>    System.Web.UI.Control.OnLoad(EventArgs e) +67
>    System.Web.UI.Control.LoadRecursive() +35
>    System.Web.UI.Page.ProcessRequestMain() +731
>
>
>
>
>
> --------------------------------------------------------------------------
--
> ----
>
> Version Information: Microsoft .NET Framework Version:1.1.4322.573;
ASP.NET
> Version:1.1.4322.573
>
>


Relevant Pages

  • Intermittant Server Error reading an MS Access DB
    ... development machine. ... An unhandled exception occurred during the execution of the ... Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.aspnet)
  • System.Data.OleDb.OleDbException: Parameter ?_1 has no default value
    ... Exception Details: System.Data.OleDb.OleDbException: Parameter ?_1 has no ... System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) ... Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Timeout on populating a datagrid
    ... I'd review the stored procedure SQL in a query tool and see how long ... An unhandled exception occurred during the execution of the ... >Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.aspnet)
  • Could not find installable ISAM
    ... An unhandled exception occurred during the execution of the ... be identified using the exception stack trace below. ... Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.aspnet)
  • Exception Details: System.Data.OleDb.OleDbException: Parameter ?_1 has no
    ... Exception Details: System.Data.OleDb.OleDbException: Parameter ?_1 has no ... System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) ... Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior ...
    (microsoft.public.dotnet.framework.aspnet)