| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1014 人关注过本帖
标题:如何实现用ID号登录,登录后显示用户名?
只看楼主 加入收藏
andriysmith
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-5-27
收藏
 问题点数:0 回复次数:4 
如何实现用ID号登录,登录后显示用户名?
请问哪位高手可以教一教我.....急用!
SqlCommand scd = new SqlCommand("select count(*) from SysUser where U_ID='" + this.UID.Text.ToString() + "' and U_PSW='" + this.Userpwd.Text.ToString() + "'", sqlcon);
        int count = Convert.ToInt32(scd.ExecuteScalar());
        if (count > 0)
        {
            Session["U_ID"] = this.UID.Text.ToString();
            this.Panel2.Visible = true;
            this.Panel1.Visible = false;
            this.Label1.Text = Session["U_ID"].ToString();
        }
        else
        {
            Response.Write(this.message("编号或者密码错误"));
        }
搜索更多相关主题的帖子: 用户名 登录 
2008-05-27 18:27
hebingbing
Rank: 6Rank: 6
来 自:黄土高坡
等 级:贵宾
威 望:27
帖 子:3417
专家分:371
注 册:2007-10-22
收藏
得分:0 
上面的程序不是可以完成你要的功能吗?
2008-05-27 21:06
petroe
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2006-10-19
收藏
得分:0 
SqlCommand scd = new SqlCommand("select count(*) from SysUser where U_ID='" + this.UID.Text.ToString() + "' and U_PSW='" + this.Userpwd.Text.ToString() + "'", sqlcon);

数据库查询语言写错了,你的那种是返回记录总数
应该这样写,
SqlCommand scd = new SqlCommand("select * from SysUser where U_ID='" + this.UID.Text.ToString() + "' and U_PSW='" + this.Userpwd.Text.ToString() + "'", sqlcon);

然后用 datereader 读出来。建议LZ多看点基础。
2008-05-27 22:22
andriysmith
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2008-5-27
收藏
得分:0 
这是显示ID号,不显示用户名
2008-05-27 23:27
cyyu_ryh
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:1899
专家分:176
注 册:2006-10-21
收藏
得分:0 
有没用户名这个字段哦?

有事无事都密我. MSN: cyyu_ryh@hotmail.co.jp E-mail: cyyu_ryh@
2008-05-28 10:34
快速回复:如何实现用ID号登录,登录后显示用户名?
数据加载中...
 
   



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

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