private void submitButton_Click_1(object sender, EventArgs e) { string customerType; string loginID = txtLoginID.Text; string password = txtPassword.Text; string name = txtName.Text; string ic = txtIC.Text; string contactNum = txtContactNum.Text; int comboIndex = comboCustomerType.SelectedIndex; bool valid = validation(loginID, password, name, ic, contactNum, comboIndex); if (valid) { customerType = comboCustomerType.SelectedItem.ToString(); cmd.Connection = registerConn; cmd.CommandText = "INSERT INTO CustomerDetail ([LoginID], [Password], [Name], [IC], [ContactNum], [CustomerType])" + "VALUES('" + loginID + "','" + password + "','" + name + "','" + ic + "','" + contactNum + "','" + customerType + "')"; try { registerConn.Open(); cmd.Parameters.AddWithValue("", loginID); cmd.Parameters.AddWithValue("", password); cmd.Parameters.AddWithValue("", name); cmd.Parameters.AddWithValue("", ic); cmd.Parameters.AddWithValue("", contactNum); int temp = cmd.ExecuteNonQuery(); if (temp > 0) { MessageBox.Show("Register Successfully!"); } else { MessageBox.Show("Not Able to register!"); } registerConn.Close(); this.Hide(); Login login = new Login(); login.ShowDialog(); } catch (Exception err) { MessageBox.Show(err.Message); registerConn.Close(); } } }
private void btnLogOut_Click(object sender, EventArgs e) { this.Hide(); Login login = new Login(); login.ShowDialog(); }