Atul Rokade

Atul Rokade

  • NA
  • 141
  • 43.8k

how to open next form base on select query base on flag

Mar 10 2017 11:29 AM
Hi all,
Iam creating one application my requirment is what when coloumn name Status is N in Registration table then current form should hide and Login form should be open
if Status is not N then its should be open Registration_Form im trying but its giving me error Error creating window handle.on rf.Show()
string connectionString = null;
connectionString = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
con.ConnectionString = connectionString;
string Comparing="N";
string query = "select Status from Registration where Status='N'";
con.Open();
OleDbCommand cmd = new OleDbCommand(query, con);
string compare = Convert.ToString(cmd.ExecuteScalar());
con.Close();
if (compare == Comparing)
{
this.Hide();
Login_Page lp = new Login_Page();
lp.Show();
}
else if (compare != Comparing)
{
Registration_Form rf = new Registration_Form();
rf.Show();
}

Answers (1)