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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top