|
楼主 |
发表于 2012-1-13 12:00:13
|
显示全部楼层
|阅读模式
来自 广东省惠州市
我的代码是这样打的可是登录不了啊
textbox 用户名 密码
数据库 用户的信息
id username password
1 www.zxknow.com 123
2 wang 321
SqlConnection con = new SqlConnection();
con.ConnectionString = "server='CWJMXT-14\\SQLEXPRESS';database='E-learning';uid='sa';pwd='stone123'";
string str = "select * from yonghu where kid='"+ TextBox1.Text.Trim() +"' and password='"+ TextBox2.Text.Trim() +"'";
con.Open ();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(str, con);
int count1 = da.Fill(ds, "table");
if (count1 == 1)
{
Response.Redirect("Home.aspx"); //登陆后你要跳转的页面
}
else
{
Label1.Text = "登陆失败";
}
|
|