您的位置:首页 > 其它

坚持真的就是胜利。现在有个小问题,求组!!!

2012-11-07 22:56 441 查看
为什么我下面的代码运行出来得不到按登录的时候不能跳转????

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.Data.SqlClient;

public partial class User_user_login : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

    }

    protected void Button1_Click(object sender, EventArgs e)

    {

        string name = TextBox1.Text;

        string pwd = TextBox2.Text;

        string SqlStr = "Server = jf7ph5fx9i5xamq; uid= sa; pwd = 1;DataBase= jdzlyw";

        SqlConnection con = new SqlConnection(SqlStr);

        SqlCommand cmd = con.CreateCommand();

        

        con.Open();

        cmd.CommandText = "select username,userpwd from user where username='" + name + "' and  userpwd='" + pwd + "'";

        SqlDataReader dr = cmd.ExecuteReader();

        if (dr.Read())

        {

            Session["user"] = name;

            Response.Redirect("user-insert.aspx");

        }

        else {

            message.Text = "用户名或密码错误";

        }

        con.Close();

    }
}

现在是2012年11月7日22:59:50,,,我是小six。。我在坚持。。坚持就是胜利,昨天的一个难题因为今天我的坚持,解决了。。。

我的毕业设计在我面前思路相当的清晰,就是代码的问题,我相信随着我不断的看书,不断的思考。。。。。会完成的!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐