better performance?

  • Thread starter Thread starter Peter Rabbit
  • Start date Start date
P

Peter Rabbit

I am using an SQL command to Insert records in a Jet database. Performance
is abyssmal (compared to C++ / DAO). Is there a better way?

The core of the code is as follows:

OleDbCommand cmd = new OleDbCommand();
cmd.Connection = sdb; // sdb is an OleDbConnection object
cmd.Connection.Open();
while (six != 0xffffffff)
{
string dbq = "INSERT INTO FDP (SIX, EPN) VALUES (" + six + ", " + epn +
")";
cmd.CommandText = dbq;
cmd.ExecuteNonQuery();
six = bin_in(fdp);
epn = bin_in(fdp);
}

Thanks
 
I am using an SQL command to Insert records in a Jet database. Performance
is abyssmal (compared to C++ / DAO). Is there a better way?

The core of the code is as follows:

OleDbCommand cmd = new OleDbCommand();
cmd.Connection = sdb; // sdb is an OleDbConnection object
cmd.Connection.Open();
while (six != 0xffffffff)
{
string dbq = "INSERT INTO FDP (SIX, EPN) VALUES (" + six + ", " + epn +
")";
cmd.CommandText = dbq;
cmd.ExecuteNonQuery();
six = bin_in(fdp);
epn = bin_in(fdp);
}

Well, what about a parametrized query? You then avoid the string
concatenations and the driver can actually re-use compiled strings.

FB
 
Bedankt, Frans. Sounds good, but could you explain what that means or give
me a documentation reference?
 
Frans - after examining the SQL PARAMETERS statement I concluded that was
unlikely to help (it seems to be aimed at user input and I couldn't see a
way of providing the parameters programmatically in an efficient way). I got
the OleDbCommand Parameters mechanism working though. However, the
performance is no better.
Groet
 
Back
Top