Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace Regform
- {
- public partial class reg : Form
- {
- public reg()
- {
- InitializeComponent();
- }
- private void btnreg_Click(object sender, EventArgs e)
- {
- string connpath = "Data Source=.\\sqlexpress;Initial Catalog=Registration_form;Integrated Security=True;Pooling=False";
- SqlConnection conn = new SqlConnection(connpath);
- string user = txtuser.Text;
- string pass=txtpass.Text;
- string fname = txtfname.Text;
- string lname = txtlname.Text;
- string ge="";
- if(rdbmale.Checked)
- {
- ge=rdbmale.Text;
- }
- if(rdbfe.Checked)
- {
- ge=rdbfe.Text;
- }
- string city = cmbcity.Text;
- string contact=txtcontact.Text;
- string insquery = "insert into regtable values('" + user + "','" + pass + "','" + fname + "','" + lname + "','"+ge +"','"+ city + "','" + contact + "')";
- SqlCommand cmd = new SqlCommand(insquery, conn);
- conn.Open();
- int cnt = cmd.ExecuteNonQuery();
- if (cnt >= 1)
- {
- MessageBox.Show("Registration successful");
- }
- else
- {
- MessageBox.Show("Please enter correct values");
- }
- conn.Close();
- }
- private void rdbmale_CheckedChanged(object sender, EventArgs e)
- {
- }
- private void btnlo_Click(object sender, EventArgs e)
- {
- log ob = new log();
- ob.Show();
- this.Hide();
- }
- private void reg_Load(object sender, EventArgs e)
- {
- }
- }
- }
Add Comment
Please, Sign In to add comment