P
Patrick.O.Ige
I have a code PASTED below.Its validate(login) against a database SQL
SERVER.
But i have a problem with the LINE:- "cmdQuestion.ExecuteReader(out dr);"
below
its says ERROR :-
"The best overloaded method match for
'System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior)
' has some invalid arguments"
Can anybody help?
-------------------------------------------------------------
// Create a command to get the question
SqlCommand cmdQuestion = new SqlCommand("SELECT Password FROM Users WHERE
Email = '" + Email.Text + "'", cn);
// Create a datareader to get the question
//myCommand.ExecuteReader();
cmdQuestion.ExecuteReader(out dr);
// Get the first row
if(dr.Read())
if(dr["Password"].ToString() == Password.Text)
CookieAuthentication.RedirectFromLoginPage(Email.Text, false);
else
Msg.Text = "Invalid password.";
else
Msg.Text = "Email address not found.";
}
}
SERVER.
But i have a problem with the LINE:- "cmdQuestion.ExecuteReader(out dr);"
below
its says ERROR :-
"The best overloaded method match for
'System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior)
' has some invalid arguments"
Can anybody help?
-------------------------------------------------------------
// Create a command to get the question
SqlCommand cmdQuestion = new SqlCommand("SELECT Password FROM Users WHERE
Email = '" + Email.Text + "'", cn);
// Create a datareader to get the question
//myCommand.ExecuteReader();
cmdQuestion.ExecuteReader(out dr);
// Get the first row
if(dr.Read())
if(dr["Password"].ToString() == Password.Text)
CookieAuthentication.RedirectFromLoginPage(Email.Text, false);
else
Msg.Text = "Invalid password.";
else
Msg.Text = "Email address not found.";
}
}