G
Guest
Hi,
I have this line of code:
string strAnswer =
(string)ds.Tables["testQuestion1"].Rows[0]["studentAnswer1"];
I got the error "There is no row at position 0", which is true coz the
database is currently empty. How do I handle the error for this ? I tried :
try {
if ( ds.Tables["testQuestion"+ intquestionId].Rows[0] != null )
{
string strAnswer =
(string)ds.Tables["testQuestion1"].Rows[0]["studentAnswer1"];
some processing;
}
}
catch (Exception ex)
{ lbl2.Text = ex.Message; }
This doesn't work as the debugger just goes skips past the code and head to
the catch handler.
TIA.
Andrew
I have this line of code:
string strAnswer =
(string)ds.Tables["testQuestion1"].Rows[0]["studentAnswer1"];
I got the error "There is no row at position 0", which is true coz the
database is currently empty. How do I handle the error for this ? I tried :
try {
if ( ds.Tables["testQuestion"+ intquestionId].Rows[0] != null )
{
string strAnswer =
(string)ds.Tables["testQuestion1"].Rows[0]["studentAnswer1"];
some processing;
}
}
catch (Exception ex)
{ lbl2.Text = ex.Message; }
This doesn't work as the debugger just goes skips past the code and head to
the catch handler.
TIA.
Andrew