I want to ask how to store the full name (from database @3) of the user into the variable fname
.
SqlDataReader rdr = cm.ExecuteReader();
string sql = "Select * from Login where Username like'" + txtUser.Text + "'and password like'" + txtPass.Text + "'";
cm = new SqlCommand(sql, cn);
dr = cm.ExecuteReader();
dr.Read();
if (dr.HasRows)
{
cn.Close();
AutoClosingMessageBox.Show("Access Granted. Welcome " + txtUser.Text + "!", "Successfully Login.", 400);
cn.Open();
UserID = cm.ExecuteScalar().ToString();
//fname = ;
Form1 frmMain = new Form1();
frmMain.pass(UserID);
frmMain.Show();
this.Hide();
//...
}
My database : @0 = ID, @1 = Username, @2 = Password, @3 = full name, @4 = binary image. I can't post photo :( >
If anyone also knows how to convert the binary into a picture, that would help me a lot thanks.