this is the way i find out if i have added a row to a dataset or not. there is a boolean value and after the row is added for the first time i set the value to false, so the next time the row is edited rather than added again. i can do this as the dataset is empty when i start, and i am only adding one row. im sure there is a more professional and better way to do this. can anyone tell me how they do it?
Code:
if(workRecordCreated == false)
{
workRow = ds.Tables["work_details"].NewRow();
workRow["patient_id"] = guid;
workRow["sitting"] = this.chkSit.Enabled;
workRow["details"] = this.details.text;
}
else
{
ds.Tables["work_details"].Rows[ds.Tables["work_details"].Rows.Count-1].BeginEdit();
ds.Tables["work_details"].Rows[ds.Tables["work_details"].Rows.Count-1]["sitting"] = this.chkSit.Enabled;
ds.Tables["work_details"].Rows[ds.Tables["work_details"].Rows.Count-1]["details"] = this.details.text;
ds.Tables["work_details"].Rows[ds.Tables["work_details"].Rows.Count-1].EndEdit();
}