注册 登录
编程论坛 ASP.NET技术论坛

用户登录界面三个条件如何实现

馨馨 发布于 2008-04-05 23:45, 2155 次点击
我的用户登录界面中有两个Textbox控件(一个用户名,一个密码),还有两个radiobotton控件(一个是管理员,一个是普通用户),我的代码是SqlCommand comm = new SqlCommand("select * from qxgl where userno='" + userno.Text.ToString().Trim() + "'and paswd='" + userpwd.Text.ToString().Trim() + "'", conn);实现了用户名和密码与数据库的连接,但是怎么实现radiobotton两个控件的选择呢?怎么编程序呢
3 回复
#2
hebingbing2008-04-06 00:10
if(radiobotton1.checked)
{
SqlCommand comm = new SqlCommand("select * from qxgl where userno='" + userno.Text.ToString().Trim() + "'and paswd='" + userpwd.Text.ToString().Trim() + "' and admin='1'", conn);
}
else
{
SqlCommand comm = new SqlCommand("select * from qxgl where userno='" + userno.Text.ToString().Trim() + "'and paswd='" + userpwd.Text.ToString().Trim() + "' and admin='0'", conn);
}
不是怎么听明白你的意思,大概猜了一下,你要的是这个吗?
#3
sldtk12008-04-06 10:46
其实用一个RadioButtonList就可以啦
#4
馨馨2008-04-06 13:57
回复 2# 的帖子
是的啊,对啊 谢谢了
1