Results 1 to 10 of 10

Thread: First Data Retrieval is very slow

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    97

    First Data Retrieval is very slow

    Hey,

    I have a program that reads in a datatable from a Access(mdb) database. The problem is that the first time accessing the database it is very slow. This only happens when the program accesses the database for the first time, the rest of the time it is very fast.


    Any help would be appreciated.

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: First Data Retrieval is very slow

    There are many possible reasons startup could be slow. We need more info to help you.
    What version of Access?
    What program is getting data from the table? Access itself (VBA), VB6, VB.Net (what version), or potentially some other app.
    What is the code for connecting to the db?
    What, if any, startup or OnLoad, if a form opens when you first open the db, procedures are there?
    Maybe a basic idea of the table structure, but if it runs ok after starting this probably isn't the problem.
    With this info, especially your code, it'll be easier to help you. Thanks.
    Tengo mas preguntas que contestas

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    97

    Re: First Data Retrieval is very slow

    Sorry,

    The Database is Access 2000, The program is vb.net, the connection object is OLEDB, the code is listed below

    Public Function GetTable(ByVal sql As String, ByVal TableName As String) As DataTable
    GetTable = New DataTable(TableName)
    Try
    With New OleDbDataAdapter(sql, Con)
    .Fill(GetTable)
    End With
    Catch ex As Exception
    Throw New Exception("Error")
    End Try
    End Function

  4. #4
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: First Data Retrieval is very slow

    It might simply be a matter of percemption. First access is sometimes slow because you are creating the connection to the database for the first time. You could remove/change that perception by using a splash screen and connecting to the database while the splash displays.
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  5. #5
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: First Data Retrieval is very slow

    Not too familiar w/VB.Net, but why would you use OLEDB to connect to Access? Wouldn't ADO/ADO.Net be more appropriate?
    I've also never seen a function that would have a datatable named the same as the function, and set as the first line in the function. Maybe that's a .Net thing.
    Tengo mas preguntas que contestas

  6. #6
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: First Data Retrieval is very slow

    I don't think that's the problem, my OleDb connections to one of my .mdb files runs very quickly, even when dealing with large numbers of records.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    97

    Re: First Data Retrieval is very slow

    yes it runs very quickly after the first access has been made, also when running crystal reports for the first time the report takes about 30 seconds to load, but after the first access it runs fast again. anyone else experienced this

  8. #8
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: First Data Retrieval is very slow

    That is the beauty of CR. [Sarcasm] The best tool in the world![/[Sarcasm]
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  9. #9
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: First Data Retrieval is very slow

    I still don't like your function, but since not using your versions am hesitant to remark on that.
    CR would require opening another connection, which could certainly slow things down. There is a forum for Crystal & other reports.
    Once a connection is opened, to whatever, it makes sense that operations would go faster.
    It seems that making the connection is your sticking point. Yes/No?
    Tengo mas preguntas que contestas

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    97

    Re: First Data Retrieval is very slow

    Ok I went to the crystal reports forum and did a search, apparently the delay is caused by the CR runtime loading for the first time.

    Thanks for the help. I'll try find a way around this.

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