?
Solved

How to Load data from a Dataset to a Database Table.

Posted on 2004-04-27
3
Medium Priority
?
209 Views
Last Modified: 2010-04-15
Hi,

 I have dumped the data from a textfile into a dataset. But I am not able to load the Data from the Dataset to the SQL Database Table.

 (Since the Rowstate remains 'Unchanged' I wont be able to use SqlDataAdapter.Update. Running through each row to upload to database would prove costly. Hence am trying to findout a simpler way.)

Please let me know if there is anyway at all..

Thanks.
0
Comment
Question by:pacchy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:chaniewskim
ID: 10926398
Using SqlDataAdapter.Update you also run through each row. So it won't be more costly if you do this.
0
 

Accepted Solution

by:
ffox04 earned 400 total points
ID: 10929247
I assume you used an adpater to load the text file data into the dataset originally (otherwise the RowState would not be Unchanged).  If so, you want to set your text file adapter.AcceptChangesDuringFill = false; before calling adapter.Fill();  That way you can call Update() on your database adapter and all the newly added rows will go into your database.
0
 
LVL 20

Expert Comment

by:TheAvenger
ID: 10933328
In the worst case, you can go over all rows and change a value (maybe to it's previous value) so that the record is marked changed. Then call Update. However the idea of ffox seams to be better
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question