|
-
Apr 30th, 2004, 02:26 PM
#1
Thread Starter
Member
Save table from DataSet to database
Hi all,
I am creating a table and populating it in runtime, then I want to save it in database.
How can I do that using ADO.NET?
Thanks.
Victor
-
Apr 30th, 2004, 03:16 PM
#2
PowerPoster
Use a dataadapter and specify an update command for it.
OR,
Loop through the datatable and build your own command and execute it against the database. (The dataadapter does this internally).
-
Apr 30th, 2004, 03:25 PM
#3
Thread Starter
Member
I am assuming that ado.net is pretty smart and I already have all info about the table in DataTable object. So, if I will just loop through columns to create table and loop through rows to insert data, I will be doing just kind of extra work, which is already done.
I hope that there is some way to just submit entire table (to create table and insert rows in it) by using ADO.NET functions.
Any ideas?
-
Apr 30th, 2004, 03:42 PM
#4
Frenzied Member
What Hellswraith said.
dataadapter1.Update(dataset1, "myTableName")
-
Apr 30th, 2004, 03:54 PM
#5
Thread Starter
Member
There is no table in database yet, it is only in memory in dataset. Nothing to update.
It maybe would have any meaning, but dataadapter doesn't have connection. To create dataadapter, you need to submit sql query and connection string.
-
Apr 30th, 2004, 07:52 PM
#6
Frenzied Member
I guess I'm not sure what you mean. You want to create a table and populate it in code, then add it to a database?
-
May 3rd, 2004, 07:46 AM
#7
Thread Starter
Member
-
Aug 30th, 2004, 10:12 AM
#8
Fanatic Member
I think this question deserves answering.
(because I'm doing the same thing!)
What I"m finding is that INSERT and UPDATE SQL commands are becoming my new best friend.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|