标题:[求助]我设计的登陆界面有什么错误??
取消只看楼主
ugene
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2007-4-6
 问题点数:0 回复次数:1 
[求助]我设计的登陆界面有什么错误??
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
ugene
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2007-4-6
得分:0 
问题是:运行后没什么错误,但是单击确定以后就什么反应也没有了!

兴趣+努力=成功
2007-06-05 08:06



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-144875-1-1.html




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

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