登录不成功,有关数据库.

来源:百度知道 编辑:UC知道 时间:2024/07/13 02:08:12
我在default.aspx中用正确的用户和密码登陆,总显示"此用户不存在".你最好远程连接我的电脑看看.我的ip:58.244.51.5 用户:hao 密码:123
请不要下病毒,谢谢.我已经用Visaul studio 打开着代码.
ip是:58.244.59.242 你可以用系统里的远程桌面连接.我的QQ
459281182

把这句申明改下看看
string strConn=@"Data Source='hao-pc';User ID='sa';Password='123';Persist Security Info=True;Pooling=False;Initial Catalog='username/SQLEXPRESS/simpleBBS'";

你看下数据库连接是否正确

数据库可能没连上或者sql语句有问题

string strconn = "server=.;database=db_doc;uid=sa;pwd=sa;";
SqlConnection conn = new SqlConnection(strconn);
SqlCommand cmd=new SqlCommand();
conn.Open();
cmd.Connection=conn;
cmd.CommandText="select password from users where username='"+TextBox1.Text+"'";
SqlDataReader dr= cmd.ExecuteReader();
try
{
if (dr.Read())
{
if (dr.GetString(0).Trim() == TextBox2.Text)
{
Session["userid"] = TextBox1.Text;
Response.Redirect("bbs.aspx");