| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 603 人关注过本帖
标题:[求助]我设计的登陆界面有什么错误??
只看楼主 加入收藏
ugene
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2007-4-6
收藏
 问题点数:0 回复次数:2 
[求助]我设计的登陆界面有什么错误??
private void btnApply_Click(object sender, System.EventArgs e)
{
string userid=textUserID.Text.Trim();
string userpassword=textUserPassword.Text.Trim();

if(userid!=""&&userpassword!="")
{
SqlConnection conn=new SqlConnection(str);
SqlCommand thisCommand=new SqlCommand();
thisCommand.Connection=conn;
thisCommand.CommandText="select * from User where UserID='"+userid+"' and UserPassword='"+userpassword+"'";
try
{
conn.Open();
}
catch(Exception ex)
{
MessageBox.Show("数据库连接失败!"+ex);
return;
}
SqlDataReader odr=thisCommand.ExecuteReader();
if(odr.Read())//如果查询记录存在
{
//globeSet=textUserPassword.Text;
MainForm list=new MainForm();
list.ShowDialog();
this.Close();
}
else
{
if(MessageBox.Show("输入的用户名或密码有误,是否重新登录?","输入有误",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
{
this.textUserID.Clear();
this.textUserPassword.Clear();
}//输入有误,重新输入。
}
odr.Close();
conn.Close();
搜索更多相关主题的帖子: 界面 thisCommand string userid 
2007-06-04 17:35
从小到大
Rank: 1
等 级:新手上路
威 望:2
帖 子:200
专家分:0
注 册:2006-6-24
收藏
得分:0 
thisCommand.CommandText="select * from [User] where UserID='"+userid+"' and UserPassword='"+userpassword+"'";

这里有问题
下次你应该把出的问题贴出来

2007-06-04 17:45
ugene
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2007-4-6
收藏
得分:0 
问题是:运行后没什么错误,但是单击确定以后就什么反应也没有了!

兴趣+努力=成功
2007-06-05 08:06
快速回复:[求助]我设计的登陆界面有什么错误??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017861 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved