Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

insert large amount of records into access database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ireallyneedtoknow2007@yahoo.com - 26 Oct 2007 18:36 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.