can someone help me speed this up. I have a dataset (from a csv file) called dsresult and I want to pump it into a firebird table. Currently I am doing it 1 row at a time, but I would prefer to do this in batches of 500 rows. I am using the firebird.net provider
string connectionString = "ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=MYDB.FDB";
string sql = "INSERT INTO POSTIN (NUMID, CHANGE, PLACENAME, BOXCODE, STRCODE, TOWN) VALUES (@NUMID, @CHANGE, @PLACENAME, @BOXCODE, @STRCODE, @TOWN)";
FbConnection conn = new FbConnection(connectionString)
FbCommand command = new FbCommand(sql, conn);
foreach (DataRow r in dsResult.Tables[0].Rows)
{
command.Parameters.AddWithValue("@NUMID", r["NUMID"]);
command.Parameters.AddWithValue("@CHANGE", r["CHANGE"]);
command.Parameters.AddWithValue("@PLACENAME", r["PLACENAME"]);
command.Parameters.AddWithValue("@BOXCODE", r["BOXCODE"]);
command.Parameters.AddWithValue("@STRCODE", r["STRCODE"]);
command.Parameters.AddWithValue("@TOWN", r["TOWN"]);
command.ExecuteNonQuery();
}
it takes aaaaaaaaaaages to run. in delphi i would have just jused cachedupdates. post 500 records at a time and commit on the 500th
Thanks