SqlConnection cnn = new SqlConnection(Pass your Connection string);
SqldataAdapter da = new SqldataAdapter("Select * from users where username = '" +txtusername.text+ "' and password = '" +txtpwd.text+ "' ",cnn);
DataSet ds = new DataSet();
da.Fill(ds);
if(ds.Tables[0].Rows.Count !=0)
{
Session["username"] = ds.Tables[0].Rows[0][2].ToString();
Responce.Redirect("Default.aspx");
}
I hope its helping to you..........!!!!!