datareader / dataadaptor -insert command

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

My design is - load a blank form which got over 30 textbox to be filled int.
The user press "new" button, input the data, After he/she press "SAVE"
I will insert the new data into tables,
Now, some textbox got several ways to do.
Case As) by using datareader.
Dim str as string ="insert mytables into xxx values(.....)"
dim drReader as reader
dim cmd as new sql command( str,conn)
Case B ) use store procedure....

Now. my problem is i need to insert over 100 fileds in a single row.
Which way is better ?
Thanks for your advice.
 
Agnes,

You can not use a datareader to write to a database, only a
command.executeXXXX or a dataadapter.update

The first one needs a nice Insert SQL string and the second one as well,
because basicly it is the same.

The stored procedure is only to get a better performance and security on
your SQL server.

I will always use the dataadapter when I know there can be concurrency
problems. When not I think there is not much difference, only the writting
of 100 insert parameters will probably let me go to use the designer and use
the dataadapter.

I hope this helps?

Cor
 
First, go find a ballpeen hammer for the person who designed the table with
100 fields ... after that, use the DACW to generate your insert/update
logic. Then work on your stored procedure (assuming you are using SQL2k).
 
Back
Top