Inserting DataTable Contents into SQL Table

MiloCold

Member
Joined
Mar 17, 2005
Messages
21
Programming Experience
Beginner
Greetings,

I have a created a datatable and have populated it with all sorts of goodies, but now I can't figure out how to insert this datatable into an already existing sql table. Can someone explain how this might be done?

I'm not sure what additional info may be needed but for starters:

-> I look like Brad Pitt
-> The datatable structure is exactly the same as the sql table
-> I lied about the whole Brad Pitt thing

Thanks in advance!

_milo
 
Last edited:

MiloCold

Member
Joined
Mar 17, 2005
Messages
21
Programming Experience
Beginner
Hmm...no help huh. Well fine. I'm gonna have to run thousands upon thousands of ad hoc queries from my loader applicatoin. How does that make you feel, hmm!?!

How can you sleep at night knowing some poor shmoe is inserting hundreds of rows from a datatable row-by-row via INSERT statements! For Shame!! Tsk-Tsk and all that jazz...

I will continue on my qwest, seeking a better method...my journey may even take to bigger and better vb .net forums. I may even get addicited to the contents that other forums provide -- THEN WHAT! Then I'll be gone and...*breaks from character*....whoa what a rant.

sorry 'bout that. So yeah, if anyone has suggestions I'm very open. I'm thinking about using bcp.exe but I'm not sure how to accomplish that from within my vb code. I'll figure it out...

Thanks in Advance

_milo
 

Paszt

Staff member
Joined
Jun 3, 2004
Messages
1,500
Location
Raleigh, NC - USA
Programming Experience
Beginner
You could insert hundreds of rows via the INSERT statement; I'll loose no sleep :).

Or you could use the Update command of a dataAdapter.
If you use the dataForm Wizard to create a form for you, you can view the resulting code and see how it's done. Or you can read through some posts in this forum for examples.
 
Top Bottom