想把第3个用户设为.net网站管理员用户

解决方案 »

  1.   

    楼主,建议你在表里加一个admin字段,int数据类型,0表示普通用户,1表示.net网站管理员,查询的时候带上这个条件就好了!
      

  2.   


    同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
      

  3.   


    同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
    好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
    新注册普通用户权限怎么自动为0
      

  4.   


    同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
    好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
    新注册普通用户权限怎么自动为0
    你可以设置字段默认的默认值为0
      

  5.   


    同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
    好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
    新注册普通用户权限怎么自动为0
    你可以设置字段默认的默认值为0
    你可以加个if条件
    if(管理员)
    {
    this.botton1.Enable=true;
    }
    else if(其他用户)
    {
    this.botton1.Enable=false;
    }
      

  6.   


    同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
    好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
    新注册普通用户权限怎么自动为0
    你可以设置字段默认的默认值为0
    你可以加个if条件
    if(管理员)
    {
    this.botton1.Enable=true;
    }
    else if(其他用户)
    {
    this.botton1.Enable=false;
    }默认值怎么设呢 ,还有这括号里代码是什么啊 就是(管理员)(其他用户)
      

  7.   


    同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
    好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
    新注册普通用户权限怎么自动为0
    你可以设置字段默认的默认值为0
    你可以加个if条件
    if(管理员)
    {
    this.botton1.Enable=true;
    }
    else if(其他用户)
    {
    this.botton1.Enable=false;
    }默认值怎么设呢 ,还有这括号里代码是什么啊 就是(管理员)(其他用户)
    而且还说不包括Button1的定义,并找不到类型为“主页”的第一个参数的扩展方法Button1 button1第一个字母我是用的大写的
      

  8.   


    同意,简单的判断就加个0,1了,如果要求权限复杂点的话,肯定要用:基于角色的访问控制(Role-Based Access Control)
    好的 然后就是设置某些按钮如“用户管理”对(1)即管理员可用,对其他用户(0)不可用 需要写什么C#代码
    新注册普通用户权限怎么自动为0
    你可以设置字段默认的默认值为0
    你可以加个if条件
    if(管理员)
    {
    this.botton1.Enable=true;
    }
    else if(其他用户)
    {
    this.botton1.Enable=false;
    }默认值怎么设呢 ,还有这括号里代码是什么啊 就是(管理员)(其他用户)
    而且还说不包括Button1的定义,并找不到类型为“主页”的第一个参数的扩展方法Button1 button1第一个字母我是用的大写的
    你的数据库是什么?
    你是准备做什么?窗体应用程序还是web?
    很简单的呀,就是判断是谁登陆的,看他是管理员还是普通用户。
      

  9.   

    我的是web程序 就是做一个用户管理的按钮Button1,只有管理员可点击这按钮,普通用户不能用这按钮
    数据库名yhgl 我想知道具体的代码
      

  10.   

    我问的是sql server2005还是什么?
    你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Button1.Enabled = false;
            string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
            if (admin == "管理员")
            {
                this.Button1.Enabled = true;
            }
            else if (admin == "普通用户")
            {
                this.Button1.Enabled = true;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {    }
    }如果楼主还不懂的话,我也没有办法了
      

  11.   

    我问的是sql server2005还是什么?
    你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Button1.Enabled = false;
            string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
            if (admin == "管理员")
            {
                this.Button1.Enabled = true;
            }
            else if (admin == "普通用户")
            {
                this.Button1.Enabled = true;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {    }
    }如果楼主还不懂的话,我也没有办法了
    if(admin=="管理员") ?  难道等号后就写“管理员”这三个字吗 
      

  12.   

    我问的是sql server2005还是什么?
    你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Button1.Enabled = false;
            string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
            if (admin == "管理员")
            {
                this.Button1.Enabled = true;
            }
            else if (admin == "普通用户")
            {
                this.Button1.Enabled = true;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {    }
    }如果楼主还不懂的话,我也没有办法了
    if(admin=="管理员") ?  难道等号后就写“管理员”这三个字吗 我问的是sql server2005还是什么?
    你的按钮如果是input标签的话,后台获取不到的,得从旁边的工具箱拉一个按钮过来,比如说这样<asp:Button ID="Button1" runat="server" Text="Button" />
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Button1.Enabled = false;
            string admin=""; //这个是获取登陆者身份,不知道楼主的效果是什么,就用字段代替了
            if (admin == "管理员")
            {
                this.Button1.Enabled = true;
            }
            else if (admin == "普通用户")
            {
                this.Button1.Enabled = true;
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {    }
    }你说 string admin= 什么叫我要的效果啊 
      

  13.   


    你的Session是登录者的用户名吧 
    你的sql语句应该写成 string admin="select admin from usermsg where ID='"+Session["ID"].Tostring+"'"
    就可以了
      

  14.   


    你的Session是登录者的用户名吧 
    你的sql语句应该写成 string admin="select admin from usermsg where ID='"+Session["ID"].Tostring+"'"
    就可以了出现问题:object不包括Tostring的定义,并且找不到可接受类型为object的第一个参数方法string
      

  15.   

    哦 ToString大小写要注意
      

  16.   

    你刚说“你的Session是登录者的用户名吧” 是不是中括号里要写管理员的ID名“绿茶e杯” 
      

  17.   

    Session["ID"]这个是自己定义的一个Session 中括号里面的可以自己定义,
     
    赋值 Session["ID"]=登录者的用户名;
    获取 string admin=Session["ID"]
    楼主 你一定要给我加分