private void button1_Click(object sender, EventArgs e)
{
if (this.userb.Text == null || this.userb.Text == "" || this.pwdb.Text == null || this.pwdb.Text == "")
{
MessageBox.Show("请把用户名、密码信息框填完整");
}
else
{
string husers, hupws;
husers = this.userb.Text.Trim();
hupws = this.pwdb.Text.Trim();
string sql = "select count(*) from 登录账户 where Userid='" + husers + "' and Pwd='" + hupws + "'";
if (GetCount(sql) > 0)
{
Form2 j = new Form2();
j.Show();
this.Hide();
}
else
{
MessageBox.Show("用户名密码错误 请重新输入!!!");
}
}
}
public int GetCount(string sql)
{
SqlConnection cons = dss.Create();
SqlCommand cmd = new SqlCommand(sql, cons);
cons.Open();
int count = (int)cmd.ExecuteScalar();
cons.Close();
return count;
}

