zoukankan      html  css  js  c++  java
  • 一个用户登录权限的基本例子

     ALTER procedure [dbo].[sp_A_UserLogin]
      (
            @CustID varchar(10), --登录编码
            @Password varchar(10),--用户密码
            @flag int output, --输出错误信息
            @Activate int output,--是否激活
            @groupID int output --权限组  
      )
      as
      declare @num int  --表示执行成功显示的条数
      declare @Activatebool int --账号是否激活
      declare @Login_qx int --登录权限
      begin
        
            select @num=count(*) from A_User where CustID=@CustID and Password=@Password   --得到的记录是等于1
            select @Activatebool= Activate from A_User where CustID=@CustID and Password=@Password
            select @Login_qx=GroupID from A_User where CustID=@CustID and Password=@Password
            if @num=1 --表示登录成功
                begin
                  if @Activatebool=1 --表示权限是激活的
                        begin
                             set @flag=1--表示登录成功
                             set @Activate=1  --设置为1
                             if @Login_qx='1'
                               set @groupID=1
                             if @Login_qx='2'
                               set @groupID=2
                             if @Login_qx='3'
                               set @groupID=3
                           end
                end
            else
                begin
                    set @flag=0--表示登录失败用户名或密码失败
                    set @Activate=0--未激活
                    set @groupID=0
                end
                
      end
     

  • 相关阅读:
    EMQTT测试--安装与测试 (windows)
    phpStudy本地搭建wordpress教程
    windows下9款一键快速搭建PHP本地运行环境的好工具(含php7.0环境)
    mysql允许外网访问 和修改mysql 账号密码
    mysql sql常用语句
    Mysql(MyISAM和InnoDB)及Btree和索引优化
    Python 有关网址
    Python 字典(Dictionary)操作详解
    pandas读取xlsx
    Python 学习笔记 (变量与数据类型)
  • 原文地址:https://www.cnblogs.com/yzenet/p/2486111.html
Copyright © 2011-2022 走看看