can commandbuilder be used with command object?

  • Thread starter Thread starter Rich
  • Start date Start date
R

Rich

Hello,

Can the commandbuilder be used with a command object? I
want to insert data into a table in sql server that has
many fields/columns from a dataTable in a vb.net project.
I am trying to get away from this though
dr = dt.Rows(i) <--not this part
'this part
cmd.CommandText = "Insert Into tblX Select " & Ctype(dr
(0), Integer) & ", " & dr(1).ToString & ",..."

I would like to do something like

"Insert Into tblX Select " & someObject

I guess I am really asking if there is some object, maybe
a custom object I could create in a class where I could
just loop through dr.ItemArray that I could place in my
select statement above?

TIA
Rich
 
Please accept my appologies if I am going nuts with posts
(it is the learning curve thing getting started
with .net). Another idea I had for my question is if I
could stuff my Row values into an xml string and read that
into my sql server table (per Row of data). Would this be
an option? Like I write dr down to some xml string and
send that to sql server, then in a loop I recreate my xml
string with the next dr?
 
Back
Top