User-2073689554 posted
Hi, I have a requirement to check if DataTable is null then copy the row to DataTable otherwise need to append the row to the DataTable.
if (dtTable == null)
{
dtTable = (from DataRow dr in dtDetails.Rows
where dr["ID"].ToString() == Id
select dr).CopyToDataTable();
}
else
{
// Here Need to Add a new row in DataTable and append the output of
query into DataTable ie dtTable.
DataRow row = selectedTable.NewRow();
dtTable = (from DataRow dr in dtDetails.Rows
where dr["ID"].ToString() == Id
select dr)
// Need help here
}
Thanks.