using DataReader :
Sqlconnection con = new sqlconnection("your conectionstring");
Sqlcommand cmd = new sqlcommand();
cmd.commandtext = "select * from table";
cmd.connection = con;
if (con.state==connectionstate.closed) con.open();
SqlDatareader dr = cmd.executereader();
while(dr.read)
{
if ( dr["Username"] == textbox1.text.trim() && dr["Password"] == textbox2.text )
{
response.redirect("Homepage.aspx");
return;
}
}