[求助]登陆框代码怎么写
密码登陆的身份验证和数据库结合起来验证的代码怎么写,数据库是ACCESS的。用ASP。NET语言。十分的急,请各位大虾帮帮忙,我是新手!!!
private void button1_click(object sender,system.eventargs e)
{
if(this.page.visible)
{
bool bflag=false;
string strname=this.tbname.text.trim();
string strpassword=this.tbpassword.text.trim();
string strsql="select id from admin where name='"+strname+"'and pwd='"+strpassword+"'and popedom=1";
conn.open();
sqlcommand mycommand=new sqlcommand(strsql,conn.dbconn);
sqldatareader myreader=mycommand.executereader();
if(myreader.read())
{
bflag=true;
}
else
{
this.label1.text="<p align=center><font color=red>用户名和密码错误,请重新输入</font></p>";
}
myreader.close();
mycommand.dispose();
conn.close();
}
}