//For Login button
// Database name username textbox
SqlDataAdapter sa = new SqlDataAdapter("select *from Login where UserName='" + UserName.Text + "' and Password='" + Password.Text + "'", con);
DataTable dt = new DataTable();
sa.Fill(dt);
if (dt.Rows.Count == 1)
{
MessageBox.Show("Welcome");
this.Hide();
Main_Form fm = new Main_Form();
fm.Show();
}
else if (dt.Rows.Count != 1)
{
MessageBox.Show("Wrong Data! Try Again");
}