D
Dom
I'vw decided to use a try-catch setup, because of a recurring bug. I
started off with just catch (SqlException), and that worked, so I got
fancier and added a catch (Exception) after it. Now the last catch is
always caught.
Here is a good snippet of the code. The "m_xxx" variables are all
class-level, and I think you can figure out the types.
public SqlDataReader test()
m_Cnn = new SqlConnection(m_ConnectionString);
m_Cnn.Open();
m_Cmd = new SqlCommand(c, m_Cnn);
try
{
m_Rdr = m_Cmd.ExecuteReader();
}
catch (SqlException e)
m_Cmd.CommandText = "<...>"
m_Rdr = m_Cmd.ExecuteReader();
}
catch (Exception e)
m_Cmd.CommandText = "<...>"
m_Rdr = m_Cmd.ExecuteReader();
}
return m_Rdr;
started off with just catch (SqlException), and that worked, so I got
fancier and added a catch (Exception) after it. Now the last catch is
always caught.
Here is a good snippet of the code. The "m_xxx" variables are all
class-level, and I think you can figure out the types.
public SqlDataReader test()
m_Cnn = new SqlConnection(m_ConnectionString);
m_Cnn.Open();
m_Cmd = new SqlCommand(c, m_Cnn);
try
{
m_Rdr = m_Cmd.ExecuteReader();
}
catch (SqlException e)
m_Cmd.CommandText = "<...>"
m_Rdr = m_Cmd.ExecuteReader();
}
catch (Exception e)
m_Cmd.CommandText = "<...>"
m_Rdr = m_Cmd.ExecuteReader();
}
return m_Rdr;