using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Data.SqlClient; public partial class SignUp : System.Web.UI.Page { DateTime dt; SqlCommand cmd; SqlConnection cn; protected void Page_Load(object sender, EventArgs e) { cn = new SqlConnection(ConfigurationManager.AppSettings["cn"]); cn.Open();===>this was error it was giving } protected void btnRegister_Click(object sender, EventArgs e) { SqlDataReader dr; cmd = new SqlCommand("Select * From Registration where uname = '" + txt_uname.Text + "' or email = '" + txt_email.Text + "'", cn); dr = cmd.ExecuteReader(); if (dr.Read()) { lblerr.Text = "User Already Exists Try Again."; } else { dr.Close(); string qu = "INSERT INTO Registration values ('" + txt_uname.Text + "','" + txt_pass.Text + "','" + txt_fname.Text + "','" + txt_mname.Text + "','" + txt_lname.Text + "','" + txt_address.Text + "','" + txt_email.Text + "','" + drp_gender.SelectedItem.Value + "','" + drp_country.SelectedItem.Value + "','" + txt_city.Text + "'," + txt_mobile.Text + ",'" + drp_sque.SelectedItem.Text + "','" + txt_ans.Text + "','')"; cmd = new SqlCommand(qu); cmd.Connection = cn; cmd.ExecuteNonQuery(); lblerr.Text = "User is Registered."; Response.Redirect("Login.aspx"); } } }
cn = new SqlConnection(ConfigurationManager.AppSettings["cn"]);
cn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)