Please help me with a code snippet to insert a value to a particular row which already exists in my DataTable .
DataRow myrow;
for (i = 1; i <= cnt2+1; i++)
{
myrow = finalRprt.NewRow();
for (j = 1; j <= lstSubName.Count + 4; j++)
{
myrow[j] = "-";
}
finalRprt.Rows.Add(myrow);
}
Now I want to add a value to the particular row depending on a condition. How can I do
This question is quite vague. But you can for example use the
DataRow.SetFieldextension methid to set a field of aDataRow.You can either use the indexer to get a row of a
DataTableor useLinq-To-DataTableto find the rows you’re searching for.Generic Field and SetField Methods (LINQ to DataSet)
Now you need a
DataAdapterto update your database (if you want).