using System.Data.SqlClient;
string strconn="server=(local);database=xwxt;uid=数据库用户名;pwd=数据库密码";
sqlconnection conn=new sqlconnection(strconn);
string str="select count(*) from denglu where username='"+txtuser.Text+"' and password='"+txtpassword.Text+"'";
SqlCommand cmd=new SqlCommand(str,conn);
conn.open;
int count=Convert.ToInt32(cmd.ExecuteScalar());
if(count>0)
{ Response.Redirect("index.aspx");
}
else
{
Response.Write("");
}
conn.Close();