locked
Inconsistent Error Message RRS feed

  • Question

  • User-2033772850 posted

    I have a page that works 3/4 of the time and then every once in a while it throws an error message.  The error message is at a place in the code where the SQL is executed:

    dbreadTWO = dbcommTWO.ExecuteReader()

    I have several subroutines and the error will land on the same line of one of them... until I disable that subroutine.  Then it will land on the line referencing the code above on a different subroutine.  But, as I say, there is no error at all about 75% of the time.  I will refresh, refresh, refresh, error, then refresh, refresh, refresh, etc.

    The error text itself also is not consistent!  I've gotten the following:

    System.Data.OleDb.OleDbException: Unknown

    Invalid SQL syntax - related tokens did not match. The Microsoft Access database engine expected GRANT...TO, REVOKE...FROM, ADD...TO, or DROP...FROM.

    Unspecified error: DB_E_ERRORSINCOMMAND(0x80040E14)

    The delete option is not allowed because a child record still exists

    I am connecting to the DB like this:

    <div>

     <add name="WMConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\192.168.0.150\data\Webmaster2011.accdb;" providerName="System.Data.OleDb" />
    

    The SQLs are all simple SELECTs -- I am not inserting or updating or deleting or anything like that.

    I know that access is rotten, etc., -- I have no choice but to work with access right now.

    Any ideas?  I have no idea how to troubleshoot with something so random!

    Monday, November 25, 2013 5:35 PM

Answers

  • User697462465 posted

    Hi geog,

    The ASP.NET Web application that has the impersonation element set to    true in the Web.config file, and that has the authentication element  set to    Windowsin the Web.config file, runs under the   impersonated account. The code in the ASP.NET Web application connects to   an Access database. When the connection is made, the Microsoft Jet OLE DB   creates temporary files in the Temp folder in the following directory:   

    Document and Settings\<var>ServerName</var>\ASPNET\Local   settings

    where <var>ServerName</var> is the name of your server.

    Try to refer to the following solution:

    • In Windows Explorer, locate the following folder:
      Document settings\<var>ServerName</var>\ASPNET\Local settings\Temp
      where <var>ServerName</var> is the name of your server.
    • Right-click the Temp folder, and then click Properties.
    • In the Properties dialog box, click the Security tab.
    • On the Security tab, click Add, and then type <var>ServerName</var>\<var>UserAccount</var> in the Select Users or Groups text box, where <var>ServerName</var> is the name of your server, and where <var>UserAccount</var> is the name of the  impersonated account. Click OK.
    • Click to select  the  Read and the Write check boxes, and then click OK.

    More information please try to refer to the following link:
    http://support.microsoft.com/kb/825738

    Hope it can help you.

    Best Regards,
    Terry Guo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 28, 2013 3:09 AM

All replies

  • User197322208 posted

    When error, log the sql statement too and stack trace. Show us code.

    Tuesday, November 26, 2013 1:38 AM
  • User-2033772850 posted

    Thank you for the response.  As I say, the location of the error seems to jump around - if I comment out one subroutine, the error moves along to the next, but is sporatic, working for a while and then not working.

    Here is an error I just got this morning as an example:

    Code at location of error:

     Protected Sub InstLIst()
            Dim dbread, dbcomm, sql
            Dim x As Integer
            x = 0
            Dim connectionString As String
            Dim dbconn As OleDbConnection
            sql = "SELECT DISTINCT Institution AS TheInst, tbl_Institution.InstID FROM tbl_Institution INNER JOIN (tbl_JoinProgramsInstitutions INNER JOIN tbl_Programs ON tbl_Programs.ProgramID = tbl_JoinProgramsInstitutions.ProgramID) ON tbl_Institution.InstID = tbl_JoinProgramsInstitutions.InstID WHERE tbl_Programs.Inactive = 0 AND tbl_Institution.State LIKE 'ME' UNION SELECT DISTINCT Alias AS TheInst, tbl_JoinInstitutionAlias.InstID FROM tbl_JoinInstitutionAlias INNER JOIN tbl_JoinProgramsInstitutions ON tbl_JoinInstitutionAlias.InstID = tbl_JoinProgramsInstitutions.InstID"
            connectionString = ConfigurationManager.ConnectionStrings("myConnectionString").ToString
            dbconn = New OleDbConnection(connectionString)
            dbconn.Open()
            dbcomm = New OleDbCommand(sql, dbconn)
            dbread = dbcomm.ExecuteReader()
            Do While dbread.Read()
                x = x + 1
                If x > 1 Then
                    Response.Write(",")
                End If
                Response.Write("'" & Replace(dbread.Item("TheInst"), "'", "\'") & "'")
            Loop
            dbread.Close()
            dbconn.Close()
        End Sub



    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.OleDb.OleDbException: Unspecified error: DB_E_ERRORSINCOMMAND(0x80040E14)

    Source Error: 

    Line 25:         dbconn.Open()
    Line 26:         dbcomm = New OleDbCommand(sql, dbconn)
    Line 27: dbread = dbcomm.ExecuteReader() Line 28:         Do While dbread.Read()
    Line 29:             x = x + 1


    Source File: \maine.aspx    Line: 27 

    Stack Trace: 

    [OleDbException (0x80040e14): Unspecified error: DB_E_ERRORSINCOMMAND(0x80040E14)]
       Microsoft.VisualBasic.CompilerServices.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags) +1608476
       Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +361
       ASP.maine_aspx.InstLIst() in maine.aspx:27
       ASP.maine_aspx.__Renderpanel1(HtmlTextWriter __w, Control parameterContainer) in maine.aspx:612
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
       System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +15
       System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +52
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       ASP.pathways_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in Pathways.master:155
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
       System.Web.UI.Page.Render(HtmlTextWriter writer) +40
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5363
    Tuesday, November 26, 2013 9:24 AM
  • User-2033772850 posted

    Just an update, another example - the error has moved to a different subroutine (even though the one I referenced above is still active).  It keeps working, not working, jumping around.  Here is the code of the second example:

     Protected Sub Program()
            Dim dbread, dbcomm, sql
            Dim connectionString As String
            Dim dbconn As OleDbConnection
            sql = "SELECT DISTINCT tbl_JoinPrograms_tDescriptor.DescriptorID, DescriptorName FROm tbl_Contacts INNER JOIN (tbl_JoinProgramsContacts INNER JOIN ((tbl_Programs INNER JOIN (tbl_JoinProgramsInstitutions INNER JOIN tbl_Institution ON tbl_JoinProgramsInstitutions.InstID = tbl_Institution.InstID) ON tbl_Programs.ProgramID = tbl_JoinProgramsInstitutions.ProgramID) INNER JOIN (tbl_JoinPrograms_tDescriptor INNER JOIN ZREF_tbl_tDescriptor ON tbl_JoinPrograms_tDescriptor.DescriptorID = ZREF_tbl_tDescriptor.DescriptorID) ON tbl_Programs.ProgramID = tbl_JoinPrograms_tDescriptor.ProgramID) ON tbl_JoinProgramsContacts.ProgramID = tbl_Programs.ProgramID) ON tbl_Contacts.ContactID = tbl_JoinPRogramsContacts.ContactID WHERE tbl_Programs.Inactive = False AND tbl_Institution.State LIKE 'ME'"
            connectionString = ConfigurationManager.ConnectionStrings("myConnectionString").ToString
            dbconn = New OleDbConnection(connectionString)
            dbconn.Open()
            dbcomm = New OleDbCommand(sql, dbconn)
            dbread = dbcomm.ExecuteReader()
            Response.Write("<option value=''></option>")
            Do While dbread.Read()
                Response.Write("<option value='" & dbread.Item("DescriptorID") & "_" & dbread.Item("DescriptorName") & "'>" & dbread.Item("DescriptorName") & "</option>")
            Loop
            dbread.Close()
            dbconn.Close()
        End Sub
        

    And the error message:

    Unspecified error: DB_E_ERRORSINCOMMAND(0x80040E14)

    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.OleDb.OleDbException: Unspecified error: DB_E_ERRORSINCOMMAND(0x80040E14)

    Source Error: 

    Line 46:         dbconn.Open()
    Line 47:         dbcomm = New OleDbCommand(sql, dbconn)
    Line 48: dbread = dbcomm.ExecuteReader() Line 49:         Response.Write("<option value=''></option>")
    Line 50:         Do While dbread.Read()


    Source File: D:\Inetpub\wwwroot\PATHWAYSASPNETweb\maine.aspx    Line: 48 

    Stack Trace: 

    [OleDbException (0x80040e14): Unspecified error: DB_E_ERRORSINCOMMAND(0x80040E14)]
       Microsoft.VisualBasic.CompilerServices.Container.InvokeMethod(Method TargetProcedure, Object[] Arguments, Boolean[] CopyBack, BindingFlags Flags) +1608476
       Microsoft.VisualBasic.CompilerServices.NewLateBinding.ObjectLateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack) +361
       ASP.maine_aspx.Program() in maine.aspx:48
       ASP.maine_aspx.__Renderpanel1(HtmlTextWriter __w, Control parameterContainer) in maine.aspx:586
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
       System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +15
       System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +52
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       ASP.pathways_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in Pathways.master:155
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +131
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +249
       System.Web.UI.Page.Render(HtmlTextWriter writer) +40
       System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +150
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5363



    Tuesday, November 26, 2013 10:24 AM
  • User697462465 posted

    Hi geog,

    The ASP.NET Web application that has the impersonation element set to    true in the Web.config file, and that has the authentication element  set to    Windowsin the Web.config file, runs under the   impersonated account. The code in the ASP.NET Web application connects to   an Access database. When the connection is made, the Microsoft Jet OLE DB   creates temporary files in the Temp folder in the following directory:   

    Document and Settings\<var>ServerName</var>\ASPNET\Local   settings

    where <var>ServerName</var> is the name of your server.

    Try to refer to the following solution:

    • In Windows Explorer, locate the following folder:
      Document settings\<var>ServerName</var>\ASPNET\Local settings\Temp
      where <var>ServerName</var> is the name of your server.
    • Right-click the Temp folder, and then click Properties.
    • In the Properties dialog box, click the Security tab.
    • On the Security tab, click Add, and then type <var>ServerName</var>\<var>UserAccount</var> in the Select Users or Groups text box, where <var>ServerName</var> is the name of your server, and where <var>UserAccount</var> is the name of the  impersonated account. Click OK.
    • Click to select  the  Read and the Write check boxes, and then click OK.

    More information please try to refer to the following link:
    http://support.microsoft.com/kb/825738

    Hope it can help you.

    Best Regards,
    Terry Guo

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 28, 2013 3:09 AM