delphi 6.0&access2000
有表login中有字段username,password,power.//power表示权限值0表示管理员,1表示一般用户
str:='Select * from login where username='''+edit1.text+''''+' and password='''+edit2.text+'''';
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add(str);
adoquery1.open;
if adoquery1.recordcount=1 then //表示存在这样一个用户
begin
if ?????='0' then form2.show;
if ?????='1' then form3.show; //我想根据用户的不同权限开启不同功能,'?????'程序应该怎样写
end;
//或者上面的程序应该怎样改
有表login中有字段username,password,power.//power表示权限值0表示管理员,1表示一般用户
str:='Select * from login where username='''+edit1.text+''''+' and password='''+edit2.text+'''';
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add(str);
adoquery1.open;
if adoquery1.recordcount=1 then //表示存在这样一个用户
begin
if ?????='0' then form2.show;
if ?????='1' then form3.show; //我想根据用户的不同权限开启不同功能,'?????'程序应该怎样写
end;
//或者上面的程序应该怎样改
自己回答:
adoquery1.fieldbyname('UserPower').asstring='0 or 1';
1.你的主界面的菜单可能做成动态菜单啊 可以先将权限保存于ini中,然后启动主菜单,根据ini中保存的数据,判断,显示相应的功能菜单2.写两个主界面,预先将各用户的功能写上去,根据登陆的不同用户的权限,调用相应的主界面.