Hi. I tried this in SQL and nobody could figure it out. I am stuck on a sql/logic problem. No matter what i do i get the same error - waiting for another function to complete. the database is working fine and i still get the same error. When i try to print to a messagebox, it breaks at the same point... wherever there is comm.ExecuteScalar(); I have printed the code below. The error message i get next to the first comm.ExecuteScalar is:
"this code has called into another function. when that function is finnished, this is the next statement that will be executed".
here is the code...
"this code has called into another function. when that function is finnished, this is the next statement that will be executed".
here is the code...
Code:
private void bLogin_Click(object sender,System.EventArgs e)
{
const string connStr = "data source= FUGUE\\NETSDK;" +
"Initial Catalog = office_DB;" + "User ID = sa;" +"Password =tomatito";
//hashPassword = HashString(tbPassword.Text);
SqlConnection conn = new SqlConnection(connStr);
string sql = "SELECT Email_Addr FROM Employees WHERE Email_Addr ='" +cbEmail.Text + "' AND Password ='"+ tbPassword +"'";
SqlCommand comm = new SqlCommand(sql, conn);
conn.Open();
//if there is a match
if(comm.ExecuteScalar() != null)
{
//minimize the signin form
SignInForm s = new SignInForm();
s.WindowState = System.Windows.Forms.FormWindowState.Minimized;
//And close this login form
this.Close();
//And open the SM GUI
Gui gui = new Gui();
gui.Show();
}
errorProvider.SetError(bLogin, ErrMsg);
MessageBox.Show("You are not in our database. Try again, register, or cancel.");
conn.Close();
conn.Dispose();
}
}