saranya S

saranya S

  • NA
  • 43
  • 56.9k

Asp.net Registration Form, need email validation in C#

Dec 11 2012 2:47 AM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page 
{
    
    protected void Page_Load(object sender, EventArgs e)
    {
        

    }
    protected void DropDownList5_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void Clear_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
        TextBox5.Text = "";
        TextBox6.Text = "";
        TextBox7.Text = "";
        TextBox8.Text = "";
        TextBox9.Text = "";
        TextBox10.Text = "";
        TextBox11.Text = "";
        RadioButtonList1.SelectedValue = null;
        TextBox12.Text = "";
        DropDownList4.SelectedValue = null;
        DropDownList5.SelectedValue = null;
        CheckBox1.Checked = false;
        Label21.Text = "";
    }
    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {

    }
    protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlDataReader dr;
        SqlConnection con = new SqlConnection("Data Source=SARANYA-TS02\\SQLEXPRESS;Initial Catalog=ss;Integrated Security=True");
        SqlCommand cmd = new SqlCommand("insert into RegistrationForm values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + TextBox4.Text
            + "','" + TextBox5.Text + "','" + TextBox6.Text + "','" + TextBox7.Text + "','" + TextBox8.Text + "','" + RadioButtonList1.SelectedValue
            + "','" + TextBox12.Text + "','" + TextBox9.Text + "','" + TextBox10.Text
            + "','" + TextBox11.Text + "','" + DropDownList4.SelectedValue + "','" + DropDownList5.SelectedValue + "')", con);
        con.Open();
        cmd.ExecuteNonQuery();
        SqlCommand cc = new SqlCommand("select from RegistrionForm where e-mail Address");
        cc.ExecuteNonQuery();
    }
    protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
    {
        
    }
    protected void TextBox7_TextChanged(object sender, EventArgs e)
    {
        
    }
    protected void TextBox2_TextChanged(object sender, EventArgs e)
    {

    }
    protected void TextBox3_TextChanged(object sender, EventArgs e)
    {

    }
    protected void TextBox9_TextChanged(object sender, EventArgs e)
    {

    }
}





 this is my code i want to modify n email id... after i click submit button if that email id is already exists means i ve to throw exception.... plz help me

Answers (15)