hello i am using c# in visual studio 2005 and need to insert a large
number of records contained in a dataset into an access database. the
following is too slow. how can i update my DataAdapter with all the
rows(150000) at one time? thanks
foreach (DataRow row in ds.Tables[0].Rows)
{
DataRow dr = ds1.Tables["testtest"].NewRow();
dr = ds1.Tables["testtest"].NewRow();
dr["field1"] = row["field1"];
dr["field2"] = row["field2"];
ds.Tables[0].Rows.Add(dr);
ad.Update(ds1, "test");
}
sloan - 26 Oct 2007 18:41 GMT
With Access?
I don't think so.
At some point, you'll be running a 1 row by 1 row operation. Whether you do
it manually, or allow the dataadapter to do it for you.
You might write a Updateable Query, and call it, but it's still a "per row"
method.
If it were me, I wouldn't rely on the dataaadapter, ... at least right your
own code for the inserts.
........
Switch to Sql Express 2005 and you'll have more options.
I have no idea what this is:
http://www.codeproject.com/dotnet/ELAB.asp
but maybe you can look into it.
> hello i am using c# in visual studio 2005 and need to insert a large
> number of records contained in a dataset into an access database. the
[quoted text clipped - 10 lines]
> ad.Update(ds1, "test");
> }
Mel - 26 Oct 2007 18:46 GMT
I'm not really up to speed on Access, but try doing the ad.Update just one
time outstide the foreach. It should improve the speed.
foreach (DataRow row in ds.Tables[0].Rows)
{
}
ad.Update(ds1, "test");
> hello i am using c# in visual studio 2005 and need to insert a large
> number of records contained in a dataset into an access database. the
[quoted text clipped - 10 lines]
> ad.Update(ds1, "test");
> }
ireallyneedtoknow2007@yahoo.com - 27 Oct 2007 16:04 GMT
> I'm not really up to speed on Access, but try doing the ad.Update just one
> time outstide the foreach. It should improve the speed.
[quoted text clipped - 26 lines]
>
> - Show quoted text -
Thank you, moving the update did the trick.