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("");
Response.Redirect("Home.aspx");
}
con.Close();

Sanwar RanwaRank #23 · 44.7K reputationPosted Aug 11, 2018, 2:32 AM EDT