473,396 Members | 2,020 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,396 software developers and data experts.

DataAdapter and MS Access

Hi, All
Please, help
I have .NET 1.1 and MS Access, i am reading text file into MS Access table,
1. I did it with following statments;
OleDbConnection conn = null;
conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + "Data
Source=C:\\Development\\WhitePlainsDB\\Data\\White Plains.mdb;");
conn.Open();

OleDbCommand cmd = new OleDbCommand(sql, conn);
cmd.Parameters.Add("@Code", OleDbType.VarChar, 10).Value = @sVill;
cmd.Parameters.Add("@TickNo", OleDbType.VarChar, 20).Value = @sTick;
Where sql is "INSERT INTO..." string
I have up to 2 million records and it takes 3 hours to accomplish this task.

I want to try with DataSet and DataAdapter,
DataSet ds = new DataSet();
DataTable tb = new DataTable("CustTable");
tb.Columns.Add("Code", typeof(String));
tb.Columns.Add("TickNo", typeof(String));
ds.Tables.Add("CustTable");
DataRow rw;
// read file in the loop
i = tb.Rows.Count + 1;
rw = tb.NewRow();
rw["Code"] = line.Substring(0, 1);
rw["TickNo"] = line.Substring(1, 10);
// populate 39 fields...
tb.Rows.Add(rw);
// End of file

OleDbDataAdapter da = new OleDbDataAdapter();
How to insert DataSet to MS Access table?
Or any other ideas, any links to this topic or code snipet
(I have to use Access db ) or should i update .NET 2.0 will be better
solution?
Please, advise if it possible at all.
Oct 9 '06 #1
1 3020
Elena,

SQLExpress with Net 2.0 and SQL bulkcopy will probably do a better job for
you. The dataset is no alternative, it will only slow your proces down and
in your present situations is in my idea the Insert the best..

http://msdn2.microsoft.com/en-us/lib...lbulkcopy.aspx

Cor

"elena" <el***@discussions.microsoft.comschreef in bericht
news:54**********************************@microsof t.com...
Hi, All
Please, help
I have .NET 1.1 and MS Access, i am reading text file into MS Access
table,
1. I did it with following statments;
OleDbConnection conn = null;
conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; " + "Data
Source=C:\\Development\\WhitePlainsDB\\Data\\White Plains.mdb;");
conn.Open();

OleDbCommand cmd = new OleDbCommand(sql, conn);
cmd.Parameters.Add("@Code", OleDbType.VarChar, 10).Value = @sVill;
cmd.Parameters.Add("@TickNo", OleDbType.VarChar, 20).Value = @sTick;
Where sql is "INSERT INTO..." string
I have up to 2 million records and it takes 3 hours to accomplish this
task.

I want to try with DataSet and DataAdapter,
DataSet ds = new DataSet();
DataTable tb = new DataTable("CustTable");
tb.Columns.Add("Code", typeof(String));
tb.Columns.Add("TickNo", typeof(String));
ds.Tables.Add("CustTable");
DataRow rw;
// read file in the loop
i = tb.Rows.Count + 1;
rw = tb.NewRow();
rw["Code"] = line.Substring(0, 1);
rw["TickNo"] = line.Substring(1, 10);
// populate 39 fields...
tb.Rows.Add(rw);
// End of file

OleDbDataAdapter da = new OleDbDataAdapter();
How to insert DataSet to MS Access table?
Or any other ideas, any links to this topic or code snipet
(I have to use Access db ) or should i update .NET 2.0 will be better
solution?
Please, advise if it possible at all.


Oct 10 '06 #2

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

Similar topics

1
by: Harry V | last post by:
I'm wondering if there is a limit of a single select, delete and insert statement (command) to each dataadapter? On a form, I have a dataconnection that is shared by 3 dataadapters, one for each of...
1
by: yma | last post by:
Hi, I tried to use a listbox to display a column in MS Access 2000 nwind.mdb by using ole DataAdapter, Connection and dataset controls. But I got "It is already opened exclusively by another...
6
by: Geoff Pennington | last post by:
I have a class method that returns a DataAdapter. I want to access the table(s) contained in the DataAdapter. Of course, accessing the DataSets would be good enough, because I could get the tables...
6
by: Andrew Cooper | last post by:
Greetings, I'm running into a little problem with a Dataadapter object. I'm using it to fill a Datatable but when I later try to Update the database using the Dataadapter.Update method, I get...
2
by: Rich | last post by:
Hello, On a form I have 3 textboxes, txt0, txt1, txt2 which contain all integers. I have also placed a connection component (conn), dataadapter component (da1) and dataset component (ds1) from...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
8
by: Zorpiedoman | last post by:
I keep getting a concurrency exception the second time I make a change and attempt to update a dataadapter. It appears this is by design, so there must be something I can do to avoid it. ...
7
by: Max | last post by:
I've included the needed tables in the DataSource. Those tables that are bound to controls I can workwith. But how do you get access to the DataAdaptors that are not bound? me.Dataset1.table...
5
by: George | last post by:
I have set DataAdapter.AcceptChangesDuringUpdate = true; However, I find that I still need to call AcceptChanges on the associated DataTable, DataTable.AcceptChanges(); Has anyone...
5
by: Emil | last post by:
I've created a very simple data base in Microsoft Access 2003. It consists of only one table called "Students" and it contains 2 information about each student: id-student and name. When I try...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.