private void AdminSignIn(object sender, EventArgs e) { //Do Validatation if (AdminID.Text == "") { MessageBox.Show("You have not entered Username"); AdminID.Focus(); } else if (AdminPass.Text == "") { MessageBox.Show("You have not entered Password"); AdminPass.Focus(); } else { try { //Opening Connection ServerInfo.MySQLConnect.Open(); //Creating objects MySqlCommand MySQLCommand = new MySqlCommand(); //Connecting the Command MySQLCommand.Connection = ServerInfo.MySQLConnect; //Passing MySQL Statement MySQLCommand.CommandText = "Select count(*) from UserMaster Where UserName = '******' " + "and UserPassword = '******' "; MySQLCommand.ExecuteNonQuery(); MySqlDataAdapter MySQLDataAdapt = new MySqlDataAdapter(MySQLCommand); //Creating a new Data Table DataTable DatTable = new DataTable(); MySQLDataAdapt.Fill(DatTable); int i = Convert.ToInt32(DatTable.Rows.Count.ToString()); if (i == 0) { MessageBox.Show("Wrong Input"); } else { this.Hide(); _3___DataEntry.DataEntry_Activities dataEntry_Act = new _3___DataEntry.DataEntry_Activities(); dataEntry_Act.Show(); } // MessageBox.Show("Successful Connection"); } catch { MessageBox.Show("Failed to Connect"); } } }
private void OnLoadSetFocus(object sender, EventArgs e) { AdminID.Focus(); }