Application is crashing while assigning to DataRow
Please look at the following code:
Vals contains 2 fields and non empty
DataRow[] dr = m_dsOptions.Tables["TABLE"].Select("ID = '" + vals[0] + "'");
if (dr.Length <= 0) // name is not in list
{
DataRow newRow = m_dsOptions.Tables["TABLE_OPTIONS"].NewRow();
newRow[0] = vals[0];
newRow[1] = vals[1];
m_dsOptions.Tables["TABLE_OPTIONS"].Rows.Add(newRow);
}
else if (1 == dr.Length) //&& dr[0][0] == vals[0])
{
dr[0][1] = vals[1];
SG:----------^ while assign the new data to the table I am getting exception. Please let me know if I am writing the code correctly
}
|