guys I have a field in my database having datatype BIT. I need to extract this value and perform an IF ELSE condition according to its value.
I tried getting the value as follows
string UStat = "SELECT UserStatus FROM " + MainForm.schema + "Adm.SysUser WHERE USerId ='" + cmbUserID.Text + "'";
cmd = ccs.CreateCommand();
ccs.Open();
cmd.CommandText = UStat;
int User_stat = ((int)cmd.ExecuteScalar());
string user_stat = Convert.ToString(User_stat);
ccs.Close();
At the level of ExecuteScalar i am being notified of an incorrect casting. Where was I wrong guys ?