为什么user附近有语法错误
using System;using System.Collections;
using
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace zyp
{
/// <summary>
/// login 的摘要说明。
/// </summary>
public class login : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.TextBox textuser;
protected System.Web.UI.WebControls.RadioButton rbtnsupper;
protected System.Web.UI.WebControls.RadioButton rbtnsystem;
protected System.Web.UI.WebControls.RadioButton rbtnuser;
protected System.Web.UI.WebControls.ImageButton ibtnlogin;
protected System.Web.UI.WebControls.ImageButton ibtncancel;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.TextBox textpwd;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
this.textuser.Text="";
this.textpwd.Text="";
}// 在此处放置用户代码以初始化页面
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ibtnlogin.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if (rbtnsupper.Checked)//如果超级管理员单选按钮选中
{
SqlConnection conn = new SqlConnection("server=.;uid=sa;pwd=;database=peisong");
conn.Open();
SqlCommand comm = new SqlCommand("select * from user where dlname='" + textuser.Text.ToString().Trim() + "'and pwd='" + textpwd.Text.ToString().Trim() + "' and powerid='1'", conn);
SqlDataReader dr = comm.ExecuteReader();
if (dr.Read())
{
Response.Redirect("main.aspx");
}
else
{
Response.Write("<script>alert('用户名或者密码错误,登录失败!')</script>");
}
conn.Close();
}
}
}
}