private void login_Click_1(object sender, EventArgs e) { if (unTextBox.Text.Length != 0 && unTextBox.Text.Length != 0) { string query = "SELECT `mem_id`, `name`, `email`, `user_name` FROM `membertable` WHERE user_name='" + unTextBox.Text + "' and password='******'"; int rowNum = db.loginRow(query); if (rowNum == 0) //query sends to connect will get an int variabe(how many rows are there if it is 0 nothing is there.); { warningText.Text = "Inavlid Username or Passward"; } else if (rowNum == -1) { warningText.Text = "Error Occured"; } else { //MainChatBox fm = new MainChatBox(); // fm.Show(); //opening 2nd class object manually without theading. db = null; this.Close(); th = new Thread(openNewForm); th.SetApartmentState(ApartmentState.STA); th.Start(); } } else { warningText.Text = "You forgot to enter Username ans Passowrd"; } }
private void deactiveButton_Click(object sender, EventArgs e) { dbNew.addMemberToContact("DELETE FROM `msgtable` WHERE msg_form = " + dbSet.mem_id() + " OR msg_to = " + dbSet.mem_id() + " "); dbNew.addMemberToContact("DELETE FROM `convtable` WHERE msgTo = " + dbSet.mem_id() + " OR msgForm = " + dbSet.mem_id() + " "); dbNew.addMemberToContact("DELETE FROM `membertable` WHERE `mem_id` = " + dbSet.mem_id() + " "); dbNew = null; this.Close(); thrd = new Thread(openNewForm); thrd.SetApartmentState(ApartmentState.STA); thrd.Start(); }