473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

insert large amount of records into access database

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");
}

Oct 26 '07 #1
3 7319

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.

<ir*******************@yahoo.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
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");
}

Oct 26 '07 #2
Mel
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");
<ir*******************@yahoo.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
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");
}

Oct 26 '07 #3
On Oct 26, 1:46 pm, "Mel" <Mel.RemoveS...@insdirect.comwrote:
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");

<ireallyneedtoknow2...@yahoo.comwrote in message

news:11**********************@o80g2000hse.googlegr oups.com...
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");
}- Hide quoted text -

- Show quoted text -
Thank you, moving the update did the trick.

Oct 27 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Luminal | last post by:
Greetings I'm having some problems on my C# application. I'm using an access database and I'm not able to do select queries with the ' character. My code is this: // some previous code like...
5
by: nicholas | last post by:
I would like to insert a new record in a Ms Access database and retrieve the newly created ID (autonumber). I would like to do it in VB.NET for an ASP.NET page. ( no asp) I found several...
0
by: jcharth | last post by:
Hello I remember there is a way to insert special charaters with ? but i cant find an example right now i am inserting data using a simple sql command line but i would like to replace my values ...
1
by: 1064871 | last post by:
Hi How to insert Data in Microsoft Access database using VB.net regards adil
1
by: pagoto123 | last post by:
i want the code to read an object (ole object) from access database to a textbox in asp.net . the object might be picture or notepad (txt) here is my command MsgBox("Result found",...
6
by: kareemaffan | last post by:
Hello Everyone I want to insert values into MS Access database through VB.NET in Visual Studio 2005 . I have used the following code which is not working. Private Sub Button2_Click(ByVal sender...
14
by: Forgemaster66 | last post by:
Hi. My first post on the forum and I hope someone can help with this problem. I have a table called 'Inventory'. It has 11 fields, two of them being 'Num' and 'Plant'. There are a number of 'Plants'...
3
by: mysore | last post by:
Hello, I have several textboxes on my VB6.0 form.I am using textboxes one for each field. I have Placed adocontrol on my form to connect to MS access database. The connectivity is fine. I...
3
by: manius | last post by:
im prety new so hope u will be patient. My questione is how to insert DataGridViewCheckBoxColumn value into access database. when i go like DataGridViewCheckBoxColumn.toString it seems does not...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.