| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2613 人关注过本帖
标题:一个很简单的登陆代码,大家帮我看一下哪里不对了。谢谢
只看楼主 加入收藏
风中的承诺
Rank: 1
等 级:新手上路
帖 子:331
专家分:0
注 册:2004-10-31
收藏
 问题点数:0 回复次数:1 
一个很简单的登陆代码,大家帮我看一下哪里不对了。谢谢
SqlConnection newConn = new SqlConnection(@"Data Source=www-08a954c4a44\sqlexpress;Initial Catalog=library;Integrated Security=True");
            newConn.Open();
这是对的
            SqlCommand thisCommand = new SqlCommand("select count(*) from User where ManagerID=" + this.textBox1.Text + " and ManagerPassword=" + this.textBox2.Text, newConn);

            SqlDataReader thisReader = thisCommand.ExecuteReader();
这里运行不通过

            if (thisReader.Read())是不是这样判断有没有返回值?
            {
                this.Visible = false;
                Form mainForm = new Form1(this.textBox1.Text, "tech");
                mainForm.ShowDialog();
                this.Close();
            }
搜索更多相关主题的帖子: 代码 登陆 
2008-09-25 21:39
海子星竹
Rank: 1
等 级:新手上路
威 望:1
帖 子:58
专家分:0
注 册:2007-9-4
收藏
得分:0 
SqlCommand thisCommand = new SqlCommand("select count(*) from User where ManagerID='" + this.textBox1.Text + "' and ManagerPassword='" + this.textBox2.Text, newConn)+"'";
2008-09-29 23:56
快速回复:一个很简单的登陆代码,大家帮我看一下哪里不对了。谢谢
数据加载中...
 
   



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

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