Performance reading records with .Net 2.0

H

Hagen Rehr

Hello Newsgroup,

the following Code reads 60.000 records from an Access Datatable:

static void Main(string[] args)
{
String connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\test.mdb";
OleDbConnection conn = new OleDbConnection(connString);
conn.Open();
OleDbCommand cmd = new OleDbCommand("select * from TAB_SCHADEN",
conn);
OleDbDataAdapter adap = new OleDbDataAdapter(cmd);
DataSet dataSet = new DataSet();
MessageBox.Show(DateTime.Now.ToLongTimeString());
adap.Fill(dataSet);
MessageBox.Show(DateTime.Now.ToLongTimeString());
conn.Close();
}

With .Net1.1 this takes 15 seconds. with .Net 2.0 it takes 3 minutes.
Anyone got the same experience. Anyone an idea how to get it faster
with .Net 2.0?


Thanks and Regards
Hagen
 
M

Marc Gravell

Well, are you just trying to read the records, or do you absolutely need the
dataset object? If the former, then you could switch to using a DataReader
instead, so you will impose far less overhead on the client (not having to
parse the data into a complex structure nor hold it all in memory at once).

Marc
 
H

Hagen Rehr

Hi Marc,

I tried using a DataReader but this didn't change a lot. It took about
2,5 minutes.

For my application I want to use a dataadapter und I want to use .NET
2.0. But why is it so slow reading the data. Am I missing something?

Hagen
 
S

spooke

Can you try using typed datase datatable and tableadpter ?
i think it will really increase the performance
"Hagen Rehr" <[email protected]> ha scritto nel messaggio
Hello Newsgroup,

the following Code reads 60.000 records from an Access Datatable:

static void Main(string[] args)
{
String connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\test.mdb";
OleDbConnection conn = new OleDbConnection(connString);
conn.Open();
OleDbCommand cmd = new OleDbCommand("select * from TAB_SCHADEN",
conn);
OleDbDataAdapter adap = new OleDbDataAdapter(cmd);
DataSet dataSet = new DataSet();
MessageBox.Show(DateTime.Now.ToLongTimeString());
adap.Fill(dataSet);
MessageBox.Show(DateTime.Now.ToLongTimeString());
conn.Close();
}

With .Net1.1 this takes 15 seconds. with .Net 2.0 it takes 3 minutes.
Anyone got the same experience. Anyone an idea how to get it faster
with .Net 2.0?


Thanks and Regards
Hagen
 
H

Hagen Rehr

I tried a typed datatable and tableadpter. This didn't change anything.
I heard, that is a problem with the .Net 2.0 DataAccess...
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

delete in c# .net 1
DataAdapter and MS Access 1
Da.fill(ds); --error 7
Fill error in dataset 3
excel read file 1
FillSchema 10
Combobox display and value member 3
reading data from excel using OLEDB 1

Top