当前位置: 代码迷 >> PB >> 菜单权限设定,该怎么处理
  详细解决方案

菜单权限设定,该怎么处理

热度:198   发布时间:2016-04-29 05:16:56.0
菜单权限设定
各位,
    请帮我看一下下面的代码,这个是设定菜单的权限的,但运行过后,可以进入程序,但所有的菜单是灰色的,不可以用。经过调试,我发现在g_result并没有值反回。
     用户的菜单权限我已存在SQL2008中的数据库的表中,如果用户是999的话,应该是可以看到菜单啊?这个程序是从7.0版本升级到12.6版本的,在老版本上是可以实现的,但到新的不知为什么不可以了,问题出在哪里?


// Browse through Menu  
menu_total1 = UpperBound(g_menu.Item)
for circle = 1 to menu_total1
 cp_name = g_menu.Item[circle].ClassName()
//  messagebox("", cp_name + gs_userid )
 
Select useright into :g_result from userright
 where rtrim(userno) =:gs_userid and menuno = :cp_name Using SQLCA ;   

 Choose Case SQLCA.SqlCode
      Case 0
                  if g_result = '1'   then
 g_menu.Item[circle].Enable()
      else
     if gs_userid = "999" then
           g_menu.Item[circle].Enable()
    else 
  g_menu.Item[circle].Disable()
    end if
  end if
case 100
g_menu.item[circle].Disable()
   Case -1
  MessageBox(parentwindow.title,"DataBase connect database fail!")
  End Choose
End For  

------解决思路----------------------
Select useright into :g_result from userright
 where rtrim(userno) =:gs_userid and menuno = :cp_name Using SQLCA ;   
这句没有返回值吗?
------解决思路----------------------
用debug模式查看
Select useright into :g_result from userright
 where rtrim(userno) =:gs_userid and menuno = :cp_name Using SQLCA ;
的 gs_userid 與 cp_name 的值
知道這2個變量的值之後, 到 SQL Server Management Studio裏去測試是否有返回值
Select useright 
 from userright
 where rtrim(userno) ='gs_userid值'
 and menuno = 'cp_name值'
  相关解决方案