solving

Download Solving

If you can't read please download the document

Upload: dhwani

Post on 28-Sep-2015

216 views

Category:

Documents


3 download

DESCRIPTION

Solving

TRANSCRIPT

String path1 = Server.MapPath("App_data/Company Database.mdf"); String constring = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + path1 + ";Integrated Security=True;User Instance=True"; SqlConnection cn = new SqlConnection(constring); cn.Open(); string sql = "insert into user_detail values('" + txtname.Text + "','" + txtaddress.Text + "','" + txtcity.Text + "','" + tpin.Text + "','" + ddldist.SelectedItem.Text + "','" + txtdob.Text + "','" + txtphone.Text + "','" + txtemail.Text + "','" + txtuserid.Text + "','" + txtpassword.Text + "','" + txtconfirmpassword.Text + "')"; SqlCommand cmd = new SqlCommand(sql, cn); string sql1 = "select userid from user_detail where userid='" + txtuserid.Text + "'"; SqlCommand cmd1 = new SqlCommand(sql1, cn); SqlDataReader rd; rd = cmd1.ExecuteReader(); if (rd.Read()) { Checkuser.Text = "user name is all ready taken"; } else { rd.Close(); cmd.ExecuteNonQuery(); Response.Redirect("~/main.aspx"); } cn.Close();