数据库已经连好了,应为没学过C#,我想看看SQL判断是怎么写的,已经怎么生成小对话框。
解决方案 »
- jquery在vs2008下运行没反应
- 用sqlcommand的executereader方法怎么读取两个以上的表
- uploadFile 控件!@
- 求高手解答,
- 急求解码
- GridView 嵌套一个Label,我想在label失去焦点时触发一个事件。怎么实现?(在线等)
- asp.net2.0+mysql(Connector/Net5) 网站发布需要安装什么?为什么数据库连接的页面出现错误?
- 急求在虚拟主机上布署水晶报表的解决方案
- 框架的低级问题~~~请指教~~
- 请问:用asp.net开发语音聊天室的若干问题,(高分相送)
- 求救!!!!我们一直在线等待:指定的参数已超出有效值的范围。参数名:value
- [请专家帮忙分析] 相当怪的问题: 关于动态载入的用户控件中的用户事件hanle
ASP我也没学过啊,能说的详细点吗!
{protected System.Web.UI.WebControls.TextBox id;
protected System.Web.UI.WebControls.TextBox pwd;
protected System.Web.UI.WebControls.Button Button1;}
private void Button1_Click(object sender, System.EventArgs e)
{
sqlCommand1.Parameters["@bid"].Value=id.Text;
sqlCommand1.Parameters["@bmm"].Value=pwd.Text;
sqlConnection1.Open();
System.Data.SqlClient.SqlDataReader reader=sqlCommand1.ExecuteReader();
if(reader.Read())
{
Session["bid"]=id.Text;
Session["bn"]=reader["bn"];
Response.Redirect("qygl.aspx"); }
else Response.Redirect("logout.aspx");
reader.Close(); sqlConnection1.Close();
}
strSql="select userID , Psw from userTable where userID=" & TextBox1.text ;
....
if (reader.Read())
{//表示有这个用户
if (reader["Psw"]==TextBox2.text)
{
//表示密码正确
}
else
{
//提示密码错误
}}
else
{
//提示没有这个用户
}
1 将&连接符改成+String strSql="select * from zhanghaoguanli where id=" + TextBox1.Text;
//2 如果你的id是字符串型,则
String strSql="select * from zhanghaoguanli where id='" + TextBox1.Text + "'";.......
应该是可以的。