[As what the title say.... This pops up whenever I try to click Login. Just
I also have another system with the same one but it doesn't have an error like this and right now I'm too blind to search for what's wrong XDD
private void btnLogin_Click(object sender, EventArgs e)
{
try
{
string constring = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=
|DataDirectory|\MMG.mdb";
string cmdText = ("SELECT COUNT(*) FROM Accounts WHERE User_name=? AND Pass_word=?");
using (OleDbConnection con = new OleDbConnection(constring))
using (OleDbCommand cmd = new OleDbCommand(cmdText, con))
{
con.Open();
cmd.Parameters.AddWithValue("@UName", txtUserName.Text);
cmd.Parameters.AddWithValue("@PWord", txtPassword.Text);
DataTable dt = db.execQuery("SELECT * FROM Accounts WHERE User_name='" + txtUserName.Text + "' AND Pass_word='" + txtPassword.Text + "'");
if (dt.Rows.Count > 0)
{
if (dt.Rows[0].ItemArray[5].ToString() == "Manager")
{
this.Hide();
frmMainForm mnf = new frmMainForm();
mnf.ShowDialog();
this.Close();
}
else if (dt.Rows[0].ItemArray[5].ToString() == "Cashier")
{
this.Hide();
Sales mnf = new Sales();
mnf.ShowDialog();
this.Close();
}
}
}
}
Thanks for the solution in advance ! :)