How to Update DataTable object data in C#
How to Update DataTable object data in C#
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.
Pankaj Kumar ChoudharyPosted May 14, 2015, 7:30 AM
if (Convert.ToInt32(row["id"]) == 4)
{
row["Name"] = "Priya Yadav";
dt.AcceptChanges();
}
Munesh SharmaPosted May 14, 2015, 7:37 AM
DataRow[] dr = dt.Select("ItemCode ="+ItemCode);
{
dr[0]["ItemName"] = txtItemName.Text;
dr[0]["ItemName"] = txtItemName.Text;
dr[0]["GroupCode"] = txtGroup.Text;
dr[0]["Price"] = txtPrice.Text;
dr[0]["Descriptions"] = txtDescriptions.Text;
}
Nanhe SiddiquePosted May 14, 2015, 7:19 AM
http://stackoverflow.com/questions/1666087/c-sharp-how-to-change-data-in-datatable
it may help you
Lalit RaghavPosted May 14, 2015, 4:11 AM
dt.Columns.Add("id", typeof(int));
dt.Columns.Add("name", typeof(string));
dt.Rows.Add(1, "lalit");
dt.Rows.Add(2, "Manoj");
dt.Rows.Add(3, "Mahesh");
dt.Rows.Add(4, "Priya");
foreach (DataRow row in dt.Rows)
{
if (Convert.ToInt32(row["id"]) == 4)
{
row["Name"] = "Priya Yadav";
}
}