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
Pankaj Kumar ChoudharyRank #80 · 24.4K reputationPosted May 14, 2015, 3:30 AM EDT
if (Convert.ToInt32(row["id"]) == 4)
{
row["Name"] = "Priya Yadav";
dt.AcceptChanges();
}
Lalit RaghavRank #1,306 · 1.3K reputationPosted May 14, 2015, 12:11 AM EDT
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";
}
}
Nanhe SiddiqueRank #1,103 · 1.7K reputationPosted May 14, 2015, 3:19 AM EDT
http://stackoverflow.com/questions/1666087/c-sharp-how-to-change-data-in-datatable
it may help you
Munesh SharmaRank #174 · 13.9K reputationPosted May 14, 2015, 3:37 AM EDT
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;
}