Asp.net fails to connect to access db after a while

Discussion in 'ASP .Net' started by mark, Oct 22, 2003.

  1. mark

    mark Guest

    My asp.net app fails to make any further connections to
    my access db after surfing for a while. This error also
    brings down the entire site for all other users as well.
    Made sure to close all connections and even call dispose
    when done. Access lock remains for a while. The file
    size of the access db grows from about 500k to 2.5 mb
    after browsing the site for a couple of minutes. I'm
    using forms authentication with a login script. Never
    ran into this problem with the same type of access db
    with asp 3.0 web applications. Just recently started
    using asp.net. Please help!
     
    mark, Oct 22, 2003
    #1
    1. Advertisements

  2. mark

    Tohid Guest

    Did you "close" and "dispose" the "OledbDataReader" and/or "DataAdaptor" in
    you behinde code?
    Check it first.
     
    Tohid, Oct 22, 2003
    #2
    1. Advertisements

  3. mark

    mark Guest

    Yes, I close the datareader. I don't see a dispose method
    for the reader though. I really can't see what would be
    causing this. Here's a example of how I'm opening and
    closing my database:
    Public Function getCatname(ByVal catID As String)
    Dim myConnection As OleDbConnection = New
    OleDbConnection(ConfigurationSettings.AppSettings
    ("ConnectionString"))
    Dim myCommand As OleDbCommand = New
    OleDbCommand("qCatName", myConnection)
    myCommand.CommandType =
    CommandType.StoredProcedure

    Dim parameterProductID As OleDbParameter = New
    OleDbParameter("catID", OleDbType.VarChar, 50)
    parameterProductID.Value = catID
    myCommand.Parameters.Add(parameterProductID)

    Try
    myConnection.Open()
    Dim rs As OleDbDataReader =
    myCommand.ExecuteReader
    Dim catName As String
    While rs.Read
    catName = rs("CATEGORY")
    End While
    rs.Close()
    Return catName
    myCommand.Dispose()
    myConnection.Close()
    myConnection.Dispose()
    myConnection = Nothing
    Catch
    Return Nothing
    End Try
    GC.Collect()
    End Function

    I'm using Access 2000 by the way. Thanks for the info.
     
    mark, Oct 22, 2003
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.