asha pawar

asha pawar

  • NA
  • 66
  • 8.9k

SelectCommand.Connection property has not been initialized.

Aug 11 2018 5:57 AM
SelectCommand.Connection property has not been initialized.
 
con = new SqlConnection(s);
con.Open();
SqlCommand cmd = new SqlCommand("select count (*) from login where emailadd='" + txtemail.Text + "' and pass='" + txtpass.Text + "'");
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
cmd.ExecuteNonQuery();
if(dt.Rows[0][0].ToString()=="1")
{ Response.Write("<script>alert('registration successfully.......')</script>");
Response.Redirect("Home.aspx");
}
con.Close();

Answers (1)