I finally solved this particular issue. The resolution to the problem was using ExecuteScalar rather than ExecuteReader to retrieve the information I needed. Here is the code that resolved my problem, in case anyone else can use it:
SqlConnection sqlConn = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
sqlConn.Open();
int knownID;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd = new SqlCommand("SELECT MAX(ID) FROM middle", sqlConn);
knownID = (int)sqlCmd.ExecuteScalar();
if(knownID > 10)
{
Response.Redirect("RegFull.aspx");
}
else
{
Response.Redirect("Registration.aspx"); }
sqlConn.Close();
|