on class.cs this is not a formCode:public void InsertRegister(string userName, string password, string sex, string email) { try { string query = "INSERT INTO login (userid, user_pass, sex, email) VALUES('" + userName + "', '" + password + "', '" + sex + "', '" + email + "')"; //open connection if (this.OpenConnection() == true) { //create command and assign the query and connection from the constructor MySqlCommand cmd = new MySqlCommand(query, connection); //Execute command cmd.ExecuteNonQuery(); MessageBox.Show("Register Successful."); } } catch (Exception ex) { if (ex.Message.IndexOf("_userid") >= 0) MessageBox.Show("That username already exists. Please change the login name."); else MessageBox.Show(ex.Message); } finally { //close connection this.CloseConnection(); } }
MessageBox.Show("Register Successful.");
i want the all textbox will be clear on form that will assign class to do it when it success.




Reply With Quote