小弟想编辑一个以数据库技术为内核的小软件.其中要求对于不同的用户赋予不同的权限,既查看权限和修改权限,但不知怎样下手.敢问那位老哥作过这方面的程序,可不可以将相关的代码告诉小弟.不胜感激.如方便可将代码发送到
解决方案 »
- ms Graph Chart 控制
- 这个远程服务器错误怎么解决?
- 请问怎么设定MSFlexGrid中单元格的宽度和高度
- 请问:vb做成安装文件后,安装好,让这个程序能随着电脑的启动而启动,要在程序代码里实现,要怎么做啊?
- webbrower怎样获得网页中javascript变量的值
- 怎样打包
- ******** 纪念9.18,纪念为抗日而牺牲的人们!**********
- [Microsoft] [ODBC 驱动程序 管理器] 未发现数据源名称并且未指定默认驱动程序
- 关于internet transfer控件
- 我想开发一个这样的软件,难吗??
- 600分之第3帖
- 好久没来了,大放600分,大家高兴高兴
结构
结构如下:Id names password 权限?
1 abc 12345 ???
temp:=edit1.Text;
pwd1:=edit2.Text;
pwd2:=edit3.Text;
quanx:=combobox1.Text;
if (temp='') or (pwd1='') or (pwd2='') then
begin
application.MessageBox(' 用户名,密码不能为空 ','信息提示',MB_IconInformation+mb_ok);
edit1.SetFocus;
end
else
if trim(edit2.Text)<>trim(edit3.Text) then
begin
application.MessageBox(' 两次密码输入不一致 ','信息提示',MB_IconInformation+mb_ok);
edit2.SetFocus;
end
else
if in_up=1 then //执行纪录插入
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from users_tab where name=:parm');
adoquery1.Parameters.ParamByName('parm').Value:=trim(edit1.Text);
adoquery1.Open;
if adoquery1.Eof then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into users_tab (name,pwd,authority) values(:user1,:pwd1,:auth) ');
adoquery1.Parameters.ParamByName('user1').Value:=trim(edit1.Text);
adoquery1.Parameters.ParamByName('pwd1').Value:=trim(edit2.Text);
adoquery1.Parameters.ParamByName('auth').Value:=trim(combobox1.Text);
adoquery1.ExecSQL;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit1.SetFocus;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from users_tab');
adoquery1.open;
end
else
begin
application.MessageBox(' 该用户已存在 ','信息提示',MB_IconInformation+mb_ok);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from users_tab');
adoquery1.Open;
edit1.Text:='';
end;
end
else
if in_up=0 then //执行纪录修改
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from users_tab where name=:parm1');
adoquery1.Parameters.ParamByName('parm1').Value:=trim(edit1.Text);
adoquery1.Open;
if adoquery1.Eof then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('update users_tab set name=:nam0,pwd=:pwd0,authority=:auth0 where name='''+nam+'''');
adoquery1.Parameters.ParamByName('nam0').Value:=trim(edit1.Text);
adoquery1.Parameters.ParamByName('pwd0').Value:=trim(edit2.Text);
adoquery1.Parameters.ParamByName('auth0').Value:=trim(combobox1.Text);
adoquery1.ExecSQL;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit1.SetFocus;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from users_tab');
adoquery1.open;
in_up:=1;
end
else
if nam=trim(edit1.Text) then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('update users_tab set pwd=:pwd0,authority=:auth0 where name='''+nam+'''');
adoquery1.Parameters.ParamByName('pwd0').Value:=trim(edit2.Text);
adoquery1.Parameters.ParamByName('auth0').Value:=trim(combobox1.Text);
adoquery1.ExecSQL;
//application.MessageBox(' 该用户已存在 ','信息提示',MB_IconInformation+mb_ok);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from users_tab ');
adoquery1.Open;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit1.SetFocus;
end
else
begin
application.MessageBox(' 该用户名已被使用 ','信息提示',MB_IconInformation+mb_ok);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select * from users_tab ');
adoquery1.Open;
edit1.SetFocus;
end
end
end;
//end;procedure Tusersetupform.But_delClick(Sender: TObject);
var
ptext:PCHAR;
begin
if adoquery1.RecordCount=0 then exit;
ptext:=PCHAR('你真的要删除当前纪录吗?');
if messagebox(Handle,ptext,'删除询问',4+32+512)=6 then
adoquery1.Delete;
in_up:=1;
edit1.Text:='';
edit2.Text:='';
edit3.Text:='';
edit1.SetFocus;
end;