Slow access to data

  • Thread starter Thread starter Quina
  • Start date Start date
Q

Quina

Hi,

I'm building an windows forms app in C#, in wich I need to store &
retrieve data. It's a very simple use of data but the to retrieve a few
records, at the first time access, it takes about 4 to 5 secs (?!!). to
load 3 records with 6 coluns in each row.
Im using table adapters, and a .mdf file to store data. The SQL server
is the express ed. 2005.

Can someone help me to speed up the process?

Thanks in advance,

João Carias
(Quina)
 
First physical connection always takes time - it is reused later (pooled),
that's why it works faster after that.
And no, you can't speed it up - first connection will always take time.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Hi,

I'm building an windows forms app in C#, in wich I need to store &
retrieve data. It's a very simple use of data but the to retrieve a few
records, at the first time access, it takes about 4 to 5 secs (?!!). to
load 3 records with 6 coluns in each row.
Im using table adapters, and a .mdf file to store data. The SQL server
is the express ed. 2005.

Can someone help me to speed up the process?

Thanks in advance,

João Carias
(Quina)
 
Well, I access a MS Access 97 database using VB2005 and the accessing is
just a quick as in VB6.

Not suprising since it is using the same ADO to do this.

The SQL that I use is very primitive and may make it irrevalent to your
problem.

I do NOT use dataadapters.

The application is to transfer an existing Access 97 DataBase file to a SSEv
database file from scratch using the available attributes and properties of
the existing MDB file to create and build the SSEv database with the
attendant tables and pre-existing data.

Dim conSourceMDB As ADODB.Connection = New ADODB.Connection
Dim rsA As ADODB.Recordset = New ADODB.Recordset
Dim strSourceTableName As String
Dim strSourceMDB As String

conSourceMDB.CursorLocation = 3 'adUseClient
strSourceMDB = "YourSourceMDBFile"
conSourceMDB.Open("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" &
strSourceMDB & ";")
rsA = New ADODB.Recordset
strSourceTableName = "YourSourceTable"
rsA.Open("SELECT * from " & strSourceTableName, conSourceMDB,
ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly)

Now you have the recordset, you can do whatever you wish with it. The
execution of the code is to all intense and purposes instanteneous with a 5
month old Intel Duo 960 processor and 1 GB of memory. Hardly a 'state of the
art' computer.

Hope this assists you.

Garry
 
Back
Top