日期:2014-05-18  浏览次数:20445 次

为什么旧数据不能登陆?
protected   void   Button1_Click1(object   sender,   EventArgs   e)
        {
                SqlConnection   conn   =   new   SqlConnection(ConfigurationManager.AppSettings[ "Conectionstring "]);
                SqlCommand   cmd   =   new   SqlCommand( "select   *   from   yonghu   where   name= ' "   +   TextBox1.Text   +   " ' ",   conn);
                try
                {
                        conn.Open();
                        SqlDataReader   sdr   =   cmd.ExecuteReader();
                        if   (sdr.Read())
                        {
                               
                                if(sdr[ "password "].ToString()==TextBox2.Text.ToString())
                                {
                                        conn.Close();
                                        Session[ "ID "]   =   TextBox1.Text.Trim();
                                        Response.Redirect( "~/Hello.aspx ");
                                       
                                }
                                else
                                {
                                       
                                        Response.Write( " <script   language=javascript> alert( '密码吆~! ') </script> ");
                                }
                        }
                        else
                        {