Your
DataSet
is referenced with
new
keyword and it doesn't have any data within it. So if you put a breakpoint over there, after debugging it you might
null
value.
And one thing as well, I don't know what
ea.selectuserdata()
is returning, I mean it must a database operation but for which user it is selecting data ?
So modify you code this way, (you can alter it later, as per the nature of the application)
public DataTable SelectUserData(string email, string password)
{
string str = "select * from user where email = '" + email + "', password = '" + password + "'" ;
SqlDataAdapter da = new SqlDataAdapter(str, connectionObj);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
MsgBox.Show("Enter the UserName");
}
if (TextBox1.Text != "")
{
if (TextBox2.Text == "")
{
MsgBox.Show("Enter the Password");
}
}
if (TextBox1.Text != "" && TextBox2.Text != "")
{
DataTable dt = ea.SelectUserData(TextBox1.Text, TextBox2.Text);
if(dt.Rows.Count > 0)
Response.Redirect("SomePage.aspx");
else
Response.Redirect("SomeOtherPage.aspx");
}
}
-KR