Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-04-27
3
Medium Priority
?
212 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

609 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