示例#1
0
        private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
            AgencyDashboard r = new AgencyDashboard();

            r.ShowDialog();
        }
示例#2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "" && textBox2.Text != "")
     {
         var conn = Database.ConnectDB();
         conn.Open();
         string         query = "SELECT * FROM Agencies WHERE Username = "******"'" + textBox1.Text + "'" + "AND Password = "******"'" + textBox2.Text + "'";
         SqlCommand     cmd   = new SqlCommand(query, conn);
         SqlDataAdapter da    = new SqlDataAdapter(cmd);
         DataTable      dt    = new DataTable();
         da.Fill(dt);
         if (dt.Rows.Count > 0)
         {
             MessageBox.Show("Login sucess Welcome to Homepage");
             this.Hide();
             AgencyDashboard r = new AgencyDashboard();
             r.ShowDialog();
         }
         else
         {
             MessageBox.Show("Invalid username and password combination");
         }
         conn.Close();
     }
     else
     {
         MessageBox.Show("Please enter Username & Password");
     }
 }