|
-
Nov 15th, 2007, 06:00 PM
#1
Thread Starter
Lively Member
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.
-
Nov 15th, 2007, 07:21 PM
#2
Frenzied Member
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
-
Nov 15th, 2007, 09:32 PM
#3
Thread Starter
Lively Member
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
-
Nov 16th, 2007, 07:26 AM
#4
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
-
Nov 16th, 2007, 07:49 AM
#5
Frenzied Member
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
-
Nov 16th, 2007, 10:26 AM
#6
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.
-
Nov 18th, 2007, 02:59 PM
#7
Thread Starter
Lively Member
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
-
Nov 18th, 2007, 03:50 PM
#8
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
-
Nov 18th, 2007, 04:48 PM
#9
Frenzied Member
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
-
Nov 18th, 2007, 09:27 PM
#10
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|