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

DataAdapter update problem

Hi!

I save 10 rows per second to a Access DataBase.
Data are copied to DataSet pro term, then I call Update fuction of
DataAdapter to refresh database.
code:
DataRow newRow;
newRow = dataSet.GPS.NewRow();
newRow["distance"] = distance;
newRow["Longitude"] = Longitude;
newRow["Latitude"] = Latitude;
dataSet11.GPS.Rows.Add(newRow);
...
oleDbDataAdapter.Update(dataSet.GPS);

Update is very slow. At 10 row saving: about 0,07s
At 100 row saving: about 0,2s
Unfortunatelly, the program running break during Update.
Is the executing of Update really so slow?

I am looking forward to your answer.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #1
2 3450
Kapti,

Are you calling Update in a loop? If so, then you might want to
populate the data set first, then call update, otherwise, you are opening
and closing the connection to the DB every iteration through the loop.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Kapti" <ga***********@gandgnovved-dot-hu.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
Hi!

I save 10 rows per second to a Access DataBase.
Data are copied to DataSet pro term, then I call Update fuction of
DataAdapter to refresh database.
code:
DataRow newRow;
newRow = dataSet.GPS.NewRow();
newRow["distance"] = distance;
newRow["Longitude"] = Longitude;
newRow["Latitude"] = Latitude;
dataSet11.GPS.Rows.Add(newRow);
..
oleDbDataAdapter.Update(dataSet.GPS);

Update is very slow. At 10 row saving: about 0,07s
At 100 row saving: about 0,2s
Unfortunatelly, the program running break during Update.
Is the executing of Update really so slow?

I am looking forward to your answer.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*

Nov 16 '05 #2
>Are you calling Update in a loop? If so, then you might want to
populate the data set first, then call update, otherwise, you are openingand closing the connection to the DB every iteration through the

loop.

Solution:
Use OleDbCommand is the fastest way to insert a row to a database:

string insertString =@"insert into GPS (distance, longitude, Latitude)
values ('"+Distance+"','"+Longitude+"','"+Latitude+"')" ;
OleDbCommand cmd = new OleDbCommand(insertString, oleDbConnection);
cmd.ExecuteNonQuery();

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #3

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

Similar topics

2
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third...
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...
13
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an...
1
by: mivey4 | last post by:
Okay, The problem is that I have an Access Database that has the following fields: EmpID - Autonumber (PrimaryKey) AccountID - Text IssueReported - Memo DateOpened ...
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. ...
1
by: Franklin M. Gauer III | last post by:
I create a simple DATAADAPTER in a webservice project. It creates the UPDATE, INSERT, DELETE commands for me - no problem. In vS2005 it creates these commands as RESOURCES in the RESX file (i.e....
2
by: Franklin M. Gauer III | last post by:
I create a simple DATAADAPTER in a webservice project. It creates the UPDATE, INSERT, DELETE commands for me - no problem. In vS2005 it creates these commands as RESOURCES in the RESX file (i.e....
6
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection =...
2
by: BobLewiston | last post by:
I can read in an SQL table ("Person.Contact") from AdventureWorks and step through it one row at a time, but when I try to save a record, either one I'm inserting or one I'm editting, I get the...
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?
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.