首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

为什么旧数据不能登陆?解决方法

2012-01-11 
为什么旧数据不能登陆?protectedvoidButton1_Click1(objectsender,EventArgse){SqlConnectionconnnewSqlC

为什么旧数据不能登陆?
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
                        {
                                Response.Write( " <script   language=javascript> alert( '用户名有问题老哥! ') </script> ");


                        }
                }
                catch   (System.Exception   ee)
                {
                        Response.Write( " <script   language=javascript> alert( ' "   +   ee.Message.ToString()   +   " ') </script> ");

                }
                finally
                {
                        conn.Close();
                }

        }
}
---------------------
这段代码,用数据库原来的数据不能登陆,可用新加入的数据就能登陆。问题在哪呢?为什么会这样?

[解决办法]
用数据库原来的数据不能登陆
-----
什么意思?是有他的信息,但是不能登陆?还是根本是其他的错误?
===
估计是 你的信息的问题?单步调试一下,看看~!~
[解决办法]
加断点 自己找

热点排行