private void buttonSignUp_Click(object sender, EventArgs e) { string fullname = textBoxfname.Text; string email = textBoxemail.Text; string pass = textBoxpassword.Text; string contact = maskedTextBoxcontact.Text; string gender = ""; if (radioButton1.Checked) { gender = "Male"; } string address = richTextBoxaddress.Text; bean beanobj = new bean(fullname, email, pass, contact, gender, address); }
public void insertData(bean beanobj) { try { login.sqlcon.Open(); string q = "insert into signup(fullname,email,pass,contact,gender,adres)values('" + beanobj.fullname + "','" + beanobj.emailgs + "','" + beanobj.passwordgs + "','" + beanobj.contactgs + "','" + beanobj.gendergs + "','" + beanobj.contactgs + "')"; SqlCommand cmd = new SqlCommand(q, login.sqlcon); cmd.ExecuteNonQuery(); MessageBox.Show("data Has inserted"); login obj = new login(); obj.Show(); login.sqlcon.Close(); } catch (Exception ex) { MessageBox.Show("Error" + ex); } }