Dear all,
Please tell me about code for edit data in DataSet and then transfer to Table in Sql Server.
thank in advance.
best regards,
Mala
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nattudurai EswaramurthyPosted Jun 8, 2012, 2:43 AM
SqlConnection nwindConn = new SqlConnection("Data Source=localhost;User ID=sa;Initial
Catalog=northwind");
SqlCommand selectCMD = new SqlCommand("SELECT * FROM Customers", nwindConn);
selectCMD.CommandTimeout = 30;
SqlDataAdapter custDA = new SqlDataAdapter();
custDA.SelectCommand = selectCMD;
try
{
nwindConn.Open();
custDA.Fill(custDS, "Customers");
DataRow[] tempDR = custDS.Tables[0].Select("ContactName = 'Maria Anders'");
tempDR[0].ItemArray[2] = "Somebody Else";
custDS.Tables[0].AcceptChanges();
custDA.Update(custDS,"Customers");
nwindConn.Close();
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
Satyapriya NayakPosted Jun 7, 2012, 10:46 PM
Please refer the below links
http://msdn.microsoft.com/en-us/library/ms233701%28v=vs.80%29.aspx
http://www.dotnetfunda.com/articles/article131.aspx
Thanks
Manath PathanaPosted Jun 7, 2012, 8:57 PM
brunda kPosted Jun 7, 2012, 2:29 PM
http://msdn.microsoft.com/en-US/library/tat996zc(v=vs.80)