newbie - Updating DB records using a stored proc in C#

  • Thread starter Thread starter Colin Basterfield
  • Start date Start date
C

Colin Basterfield

Hi,

I have a backend dll, a web service and then a web frontend.

The frontend displays a list of artists by way of a stored proc into a
dataset bound to a datagrid, I have implemented Edit/Save/Cancel, so you can
edit the names of them, and OnSave posts the name and id back, and calls an
update stored proc that updates the name where the id is the id passed back.
Where I fall over is how to update the record, do I have to instantiate an
UpdateCommand pointing to the stored proc with parameters which I then
attach to a DataAdapter? Also once attached what command do I call to make
the update?

Also can I just add the connection to the UpdateCommand, and simply
instantiate the SqlDataAdapter without any params?

Many thanks for any info...

TIA
Colin B
 
Hi Colin,

Colin Basterfield said:
Hi,

I have a backend dll, a web service and then a web frontend.

The frontend displays a list of artists by way of a stored proc into a
dataset bound to a datagrid, I have implemented Edit/Save/Cancel, so you can
edit the names of them, and OnSave posts the name and id back, and calls an
update stored proc that updates the name where the id is the id passed back.
Where I fall over is how to update the record, do I have to instantiate an
UpdateCommand pointing to the stored proc with parameters which I then
attach to a DataAdapter?

Yep.

Also once attached what command do I call to make
the update?

dataadapter.Update(table)
(your data should be stored in DataTable.)
Also can I just add the connection to the UpdateCommand, and simply
instantiate the SqlDataAdapter without any params?

Huh?
 
Back
Top