Solved

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

Posted on 2004-04-27
3
202 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
3 Comments
 
LVL 5

Expert Comment

by:chaniewskim
Comment Utility
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 100 total points
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now