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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
brunda kRank #3,804 · 389 reputationPosted Jun 7, 2012, 10:29 AM EDT
http://msdn.microsoft.com/en-US/library/tat996zc(v=vs.80)
Manath Pathana86 reputationPosted Jun 7, 2012, 4:57 PM EDT
Satyapriya NayakRank #47 · 31.5K reputationPosted Jun 7, 2012, 6:46 PM EDT
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
Nattudurai EswaramurthyRank #5,536 · 296 reputationPosted Jun 7, 2012, 10:43 PM EDT
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);
}