How to Update Disconnected Dataset through Stored Procedure

C

chandu

Hi Guys,

i am beginer in the worls of Asp.net and C#.net
I have one problem that
I have stored my changes of data into dataset using
disconnected dataset and after completion of all changes i want to
update that change to the database using stored procedure.


But i am not getting How to do it,

So if anybody know the slution then please give me


Regards
Chandra Tiwari
 
G

Guest

You need to send the changed DataSet into a DataAdapter that has the required
Update, Insert and Delete commands (they can be stored procedures) and then
call the Adapter's Update method.
Peter
 
D

Duggi

Sample code here....

SqlConnection connection = new SqlConnection(@"connection
String");
SqlDataAdapter dataAdpater = new SqlDataAdapter("Query",
connection);
DataSet dataset = new DataSet();

dataAdpater.Fill(dataset);

DataRow row = dataset.Tables["Table"].Rows[0];
row["Column"] = "new data";


dataAdpater.UpdateCommand.CommandType =
CommandType.StoredProcedure;
dataAdpater.UpdateCommand.CommandText = "StoredProcedure
name";

dataAdpater.Update();

Hope this is useful....

Thanks
-Srinivas,
 

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

Top