private void btnLogin_Click(object sender, EventArgs e)
{
{
Connections.con.Open();
string login = "SELECT ID, Username, [Password] FROM Employee";
OleDbCommand command = new OleDbCommand(login, Connections.con);
command.Connection = Connections.con;
command.Parameters.AddWithValue("@?", txtLUser.Text.ToString());
command.Parameters.AddWithValue("@?", txtLPass.Text.ToString());
OleDbDataReader reader = command.ExecuteReader();
int count = 0;
while (reader.Read())
{
count = count + 1;
break;
}
if (count == 1)
{
MessageBox.Show("Login Successful.");
this.Close();
}
else
{
MessageBox.Show("Please enter a valid Username or Password");
}
Connections.con.Dispose();
Connections.con.Close();
MessageBox.Show("Thank you for using this Simple Login/Registration Form.");
}
仍然记录它总是每当我点击登录按钮,并在用户名/密码文本框,我还没有录入任何而且没有空白在我利用注册登录数据库 有什么建议?我不输入任何帐户,但在
您错过了属性 – Tushar 2014-10-09 13:02:31
什么属性先生? OMG! – 2014-10-09 13:04:57