position:=DBM.adoquery1.FieldByName('职位').AsString;
edit2.Text:=position;
这两句没问题  发上来是说明它是干嘛的下面哪有问题
  mainf.MainMenu1.Items[0].Enabled:=false;
  mainf.MainMenu1.Items[1].Enabled:=false;
  mainf.MainMenu1.Items[2].Enabled:=false;
这三行过后  MAINF窗体的菜单失效    下面是恢复其中的可用项  可是恢复不了  该怎么写?(我没用特别建表去设置权限的  只是简单判定)  if position=''+酒店管理+''  then
      mainf.MainMenu1.Items[0].Enabled:=true;
  if position=''+前台接待+''  then
      mainf.MainMenu1.Items[1].Enabled:=true;
  if position=''+客房管理+''  then
      mainf.MainMenu1.Items[2].Enabled:=true;

解决方案 »

  1.   

    如果edit2.text显示的是 +酒店管理+  if position='+酒店管理+'  then 
          mainf.MainMenu1.Items[0].Enabled:=true; 
      if position='+前台接待+'  then 
          mainf.MainMenu1.Items[1].Enabled:=true; 
      if position='+客房管理+'  then 
          mainf.MainMenu1.Items[2].Enabled:=true;如果edit2.text显示的是 '+酒店管理+'  if position='''+酒店管理+'''  then 
          mainf.MainMenu1.Items[0].Enabled:=true; 
      if position='''+前台接待+'''  then 
          mainf.MainMenu1.Items[1].Enabled:=true; 
      if position='''+客房管理+'''  then 
          mainf.MainMenu1.Items[2].Enabled:=true;
      

  2.   


    if position='酒店管理'  then 
          mainf.MainMenu1.Items[0].Enabled:=true; 
      if position='前台接待'  then 
          mainf.MainMenu1.Items[1].Enabled:=true; 
      if position='客房管理'  then 
          mainf.MainMenu1.Items[2].Enabled:=true;试试
      

  3.   

    根据DBM.adoquery1.FieldByName('职位').AsString 可以判断 这几个字符串应该来自数据库中的职位字段记录。不会在数据库中 插入 +酒店管理+  或者  '+酒店管理+' 吧
      

  4.   

    那个position是变量  它获取的是数据库职位字段的 记录我现在就是想判断position获取的记录是否和以上那三组汉字相等(仅仅是那4个汉字  没有其它字符  我新手  可能表达不正确)
      

  5.   

    @ks_reny 
    同意这个,应该是这样的!可以自己看看接出来的值是什么样的
      

  6.   


    加个button,点击事件,showmessage(position)显示的是什么,再加
    if position = '酒店管理' then showmessage('相同') else 不同我怀疑你是position变化了
      

  7.   

    一个不是很标准的办法:
    if pos('酒店管理',position)>0  then 
          mainf.MainMenu1.Items[0].Enabled:=true; 
      

  8.   


    showmessage(position)
    看看position 是什麽內容
      

  9.   

    position:=trim(DBM.adoquery1.FieldByName('职位').AsString); 
    edit2.Text:=position; 
      

  10.   

            if trim(position)='酒店管理'  then 
          mainf.MainMenu1.Items[0].Enabled:=true; 
      if trim(position)='前台接待'  then 
          mainf.MainMenu1.Items[1].Enabled:=true; 
      if trim(position)='客房管理'  then 
          mainf.MainMenu1.Items[2].Enabled:=true;