Results 1 to 2 of 2

Thread: MS Access and asp.net Problem...UGHH!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    MS Access and asp.net Problem...UGHH!!

    I have a asp.net that uses an access 2003 database. I get this strange event where the page will work for 10 or so times and then I get this:

    VB Code:
    1. Line 144:
    2. Line 145:
    3. Line 146:            myConnection.Open()
    4. Line 147:
    5. Line 148:            'Create an OleDbCommand object.
    6.  
    7.  
    8. Source File: C:\Components\ProductsDB.vb    Line: 146
    9.  
    10. Stack Trace:
    11.  
    12.  
    13. [OleDbException (0x80004005): Unspecified error]
    14.    System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
    15.    System.Data.OleDb.OleDbConnection.InitializeProvider()
    16.    System.Data.OleDb.OleDbConnection.Open()
    17.    IBuySpy.IBuySpy.ProductsDB.GetMainCategories() in C:\Documents and Settings\Administrator\Desktop\Components\ProductsDB.vb:146
    18.    IBuySpy.C_Menu2.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\Desktop\_Menu2.ascx.vb:57
    19.    System.Web.UI.Control.OnLoad(EventArgs e)
    20.    System.Web.UI.Control.LoadRecursive()
    21.    System.Web.UI.Control.LoadRecursive()
    22.    System.Web.UI.Page.ProcessRequestMain()

    What is so strange is that it works for a while and then just cuts out.
    The error message (what line the error is on) changes but it always happens
    when it is going to open a connection to the database. I've checked to make
    sure that all connections were closed before I opened another. Any Ideas?

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    142

    Talking Re: MS Access and asp.net Problem...UGHH!!

    I found out what it was - with no help from Microsoft!!

    If you are using an Access database with ASP.net, it would be a good prcatice not to open two connections to a database at the same time.

    For instance, I have a datalist that is databound in the Page_Load event.
    In that datagrid is a function that gets the category name for the database.
    This function opens up another connection to the database.

    This is a No-No as I receive an unhadled exception error after refreshing the page 10 or 12 times. To get around this, I declared a public variable as a string in the Codebehind and ran the function once in the Page_Load event. I then put that global variable in the datagrid instead of calling the function over and over again. This also make the page load quicker and decreases the number of times the Database gets hit with requests.

    So if you get the Error Message: Error '80004005' Unexpected Error after refreshing several times, try making sure that all your connection strings are properly closed and that you don't have more than one connection open at a time. this can happen in datalists,repeaters,datagrids and when using for and while loops.

    Hope this helps someone!

Posting Permissions

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



Click Here to Expand Forum to Full Width