|  | 
| public partial class kaipiaoziliao_loginpage: System.Web.UI.Page {
 protected void Page_Load (object sender, EventArgs e)
 {
 
 }
 protected void Button1_Click (object sender, EventArgs e)
 {
 SqlConnection con = new SqlConnection ();
 con.ConnectionString = "Server = i-server; database = fapiao; integrated security = SSPI;";
 
 SqlCommand objcmd = new SqlCommand ();
 objcmd.Connection = con;
 objcmd.CommandText = "select shuihao from cheeck where shuihao = '" + Convert.ToInt32 (TextBox1.Text.Trim ()) + "'";
 con.Open ();
 SqlDataReader dr = objcmd.ExecuteReader ();
 if (dr.Read ())
 {
 Session ["shuihao"] = TextBox1.Text.Trim ();
 Response.Redirect ("cheeck.aspx");
 }
 else
 {Response.Write ("<script language = 'javascript'> window.alert ('Your input is incorrect, please re-enter!'); </ Script>");}
 }
 
 }
 The above is my program segment, but SqlDataReader dr = objcmd.ExecuteReader () appears at runtime; is this line of error, is it because the database is not connected?
 | 
 |