private void button1_Click(object sender, EventArgs e)
{
try
{
//SqlConnection con = new SqlConnection(strcon);
//DataSet ds = new DataSet();
//SqlDataAdapter sda = new SqlDataAdapter(strcon, con);
//sda.Fill(ds);
//return ds;
string sql = string.Format("select uname,password,userrole from tb_userinfo where uname={0}", this.tb_name.Text.Trim());
DataSet ds = sqlHple.GetDateSet(sql);
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
//判断当前用户登录进来的密码是否与传进来的密码相等
if (ds.Tables[0].Rows[0]["uname"].ToString().Equals(this.tb_pwd.Text.Trim()))
{
//对用户名和用户角色进行赋值
Program.username = ds.Tables[0].Rows[0]["uname"].ToString();
Program.userrole = ds.Tables[0].Rows[0]["userrole"].ToString();
//是否显示主窗体
Program.isshowmina = true;
this.Close();
}
else
{
MessageBox.Show("用户密码输入错误");
}
}
else
{
MessageBox.Show("用户名输入错误");
return;
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
他说'='附件有语法错误 但是看来看去去也不知道有什么错误 sql语句没有错呀