write the sql statement out and run the query manually in SQL Query Analyzer to make sure it returns anythingString SelCmd="select [userinfo].username,[userinfo].password from [userinfo]";
SelCmd+="where [userinfo].username='%"+loginbox.Text+"%' and [userinfo].password='%"+passwordbox.Text+"%'";Response.Write("****" + SelCmd + "***");by the way, you should be doing something likeSqlConnection cnn=new SqlConnection("server=paradise;uid=sa;pwd=;database=book");
String SelCmd="select count(*) from userinfo where username = '"+loginbox.Text +"' and password='"+passwordbox.Text+"'";
SqlCommand myComm=new SqlCommand(SelCmd,cnn);
cnn.Open();
int nCount = (int)myComm.ExecuteScalar();
cnn.Close(); if (nCount > 0)
{
Session["logok"]="-1";
loginlb.Text="welcom.you have logined";
Session["userid"]="tom";
serchbtn.Visible=true;
}
else
{
Response.Redirect("http://localhost/hs/error.aspx");
}
SelCmd+="where [userinfo].username='%"+loginbox.Text+"%' and [userinfo].password='%"+passwordbox.Text+"%'";Response.Write("****" + SelCmd + "***");by the way, you should be doing something likeSqlConnection cnn=new SqlConnection("server=paradise;uid=sa;pwd=;database=book");
String SelCmd="select count(*) from userinfo where username = '"+loginbox.Text +"' and password='"+passwordbox.Text+"'";
SqlCommand myComm=new SqlCommand(SelCmd,cnn);
cnn.Open();
int nCount = (int)myComm.ExecuteScalar();
cnn.Close(); if (nCount > 0)
{
Session["logok"]="-1";
loginlb.Text="welcom.you have logined";
Session["userid"]="tom";
serchbtn.Visible=true;
}
else
{
Response.Redirect("http://localhost/hs/error.aspx");
}
解决方案 »
- 一个关于asp 的问题
- 梅花雨日历控件,页面加入codepage='936',返回的表单内容,中文出现乱码。
- 关于产品按照指定数字顺序排列的问题
- 急求:一份以个人名义与一家公司签署的一份软件开发合同
- 足球32强的列表截图,像这种显示效果,用什么控件为好呢?
- 问题:如何从指定文件夹下搜索某一个指定的文件名,并将此文件的路径输出
- 用datagrid实现编缉,修改,取消功能时验证控件问题?
- 请问如何将jpg转换成eps格式导出
- 如何限制用户输入TextBox中的字符必须为中文??
- 如何获得域名服务器中的该域名下的所有用户列表?
- 我想在asp.net中继续使用iframe的网页编辑功能,可是。。。
- 网页中的refresh
i 'v made it!!