protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = null; try { con = DbLogic.GetConnection(); con.Open(); String query = "insert into reg values ('" + txtname.Text + "','" + txtmail.Text + "','" + txtmob.Text + "','" + txtadd.Text + "','" + txtpass.Text + "','" + prf.SelectedItem.Text + "')"; SqlCommand com = new SqlCommand(query, con); int result = com.ExecuteNonQuery(); if (result == 1) { Lbl.Text = "Record is Inserted successfully"; Response.Redirect("Cust_LogIn.aspx"); } } catch (Exception err) { Lbl.Text = err.Message.ToString(); txtname.Text = ""; txtmail.Text = ""; txtmob.Text = ""; txtadd.Text = ""; } finally { if (con != null) { con.Close(); } } }
protected void Button1_Click(object sender, EventArgs e) { SignInfo sj = new SignInfo(); SqlConnection con = null; try { con = DbLogic.GetConnection(); con.Open(); String query = "select * from reg where Mobile = '" + txtm.Text + "' and Password = '******'"; SqlCommand com = new SqlCommand(query, con); SqlDataReader dr = com.ExecuteReader(); if (dr.Read()) { Session["Mobile"] = txtm.Text; Session["Name"] = dr[0].ToString(); Session["Address"] = dr[3].ToString(); Response.Redirect("Customer_After_Login.aspx"); //Lbl.Text = "Successfully Logged"; } else { Label3.Text = "INVALID MOBILE OR PASS"; } } catch (Exception err) { Label3.Text = err.Message; } finally { if (con != null) { con.Close(); } } }