コード例 #1
0
 public void Foureminsert(Forumregister ob)
 {
     try
     {
         mcon.Open();
         string     sqlQ = "insert into Forum_Registration(UserName,Password,fullname,gender,dob,emailid) values ('" + ob.userName + "','" + ob.password + "','" + ob.fullname + "','" + ob.gender + "','" + ob.dob + "','" + ob.emailid + "')";
         SqlCommand cmd  = new SqlCommand(sqlQ, mcon);
         cmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
     }
     finally
     {
         mcon.Close();
     }
 }
コード例 #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string gen = "";

            if (RadioButton1.Checked)
            {
                gen = "Male";
            }
            else if (RadioButton2.Checked)
            {
                gen = "Female";
            }
            Forumregister sob   = new Forumregister(TextBox1.Text, TextBox2.Text, TextBox6.Text, gen, TextBox4.Text, TextBox5.Text);
            Class1        dbcon = new Class1();

            dbcon.Foureminsert(sob);
            Response.Write("<script LANGUAGE='JavaScript' >alert('Save Successful')</script>");
            Response.Redirect("login.aspx");
            TextBox1.Text = string.Empty;
            TextBox2.Text = string.Empty;

            TextBox4.Text = string.Empty;
            TextBox5.Text = string.Empty;
        }