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;
}

C# WinForm的代码,有帮助能点个采纳吗 ,谢谢~
这是c#, 很多语法都能看出来的,比如:
MessageBox.Show()就是c#的语法。
如有帮助,请采纳。点击我回答右上角[采纳]按钮
我大意了,不是java
这是c#,太好认了。