protected void Button1_Click(object sender, EventArgs e) { string strpassword = Encryptdata(TextBox3.Text); dream11.mainregister obj = new dream11.mainregister(); dream11.prpregister objx = new dream11.prpregister(); objx.email = TextBox1.Text; objx.username = TextBox2.Text; objx.pass = strpassword; objx.conpass = strpassword; objx.address = TextBox5.Text; objx.phone = Convert.ToInt64(TextBox6.Text); objx.usertype = "U"; Clear_Rec(); try { obj.Save_Rec(objx); Response.Redirect("login.aspx"); } catch (Exception exp) { } }
public void Save_Rec(prpregister p) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = new SqlCommand("register1", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@email", SqlDbType.VarChar, 100).Value = p.email; cmd.Parameters.Add("@username", SqlDbType.VarChar, 100).Value = p.username; cmd.Parameters.Add("@pass", SqlDbType.VarChar, 100).Value = (p.pass); cmd.Parameters.Add("@conpass", SqlDbType.VarChar, 100).Value = (p.conpass); cmd.Parameters.Add("@address", SqlDbType.VarChar, 100).Value = (p.address); cmd.Parameters.Add("@phone", SqlDbType.BigInt).Value = (p.phone); cmd.Parameters.Add("@usertype", SqlDbType.Char, 1).Value = p.usertype; cmd.ExecuteNonQuery(); con.Close(); cmd.Dispose(); }