我用DELPHI作一数据库系统,在combobox中输入用户名时,操作一次后,再次输入时便提示“在此环境下不能执行此操作”,在baidu上搜竟然没有搜到相关帖子,请各位高手指点
解决方案 »
- 关于datasnap的一点傻傻的问题,谢谢各位大侠帮我一下
- Delphi中Tquery查询SQLSERVER返回的recordcount有误
- delphi字段是中文了如何做报表
- 眼睛花 了 帮我看看我的insert 语句
- 我在button2中如何调用button1的click事件?
- 客户老说我的程序使用还可以,就是不好看,不美观,怎么办?怎么让我的程序美观起来???
- 该死的http://ok100.allyes.com/main/
- 有没有人用过DBchart,给个具体的例子好吗?
- 怎样在listbox中保存信息?
- 哪位大哥知道哪儿有 好看的图标。 数据库类, 增加.删除.修改等
- 求教高手,D6在WIND 2K3上的安装后的问题(project ->option)
- 大家来看看这个软件的图标拖动功能怎么实现的?
begin
if combobox1.text<>'' then
begin
adodataset1.Close;
adodataset1.CommandText:='select * from mima where 用户名=:username';
adodataset1.Parameters.clear;
adodataset1.Parameters.AddParameter;
adodataset1.Parameters[0].Name:='username';
adodataset1.Parameters[0].DataType:=ftstring; adodataset1.Parameters[0].Direction:=pdinput;
adodataset1.Parameters[0].Value:=combobox1.text;
adodataset1.Active:=true;
if adodataset1.Recordset.RecordCount=1 then
begin
if radiobutton1.Checked then
begin
application.MessageBox('用户名重复,请重新输入!','提示信息',mb_ok);
combobox1.SetFocus;
end
else
begin
RadioButton4.Checked:=adodataset1.fieldbyname('权限一').asboolean;
RadioButton5.Checked:=adodataset1.fieldbyname('权限二').asboolean;
end;
end
else
begin
if not RadioButton1.Checked then
begin
application.MessageBox('没有该用户名,请检查!','提示信息',mb_ok);
combobox1.SetFocus;
end;
end;
adodataset1.close;
end;
end;
procedure TForm2.ComboBox1Exit(Sender: TObject);
begin
if combobox1.text < > ' ' then
begin
adodataset1.Close;
adodataset1.CommandText:= 'select * from mima where 用户名=:username ';
adodataset1.Parameters.clear;
self.ADODataSet1.Parameters.ParamByName('username').Value:=combobox1.text;
adodataset1.open;
if ADODataSet1.RecordCount=1 then
begin
if radiobutton1.Checked then
begin
application.MessageBox( '用户名重复,请重新输入! ', '提示信息 ',mb_ok);
combobox1.SetFocus;
end
else
begin
RadioButton4.Checked:=adodataset1.fieldbyname( '权限一 ').asboolean;
RadioButton5.Checked:=adodataset1.fieldbyname( '权限二 ').asboolean;
end;
end
else
begin
if not RadioButton1.Checked then
begin
application.MessageBox( '没有该用户名,请检查! ', '提示信息 ',mb_ok);
combobox1.SetFocus;
end;
end;
adodataset1.close;
end;
end;
procedure TForm2.ComboBox1Exit(Sender: TObject);
begin
if combobox1.text < > ' ' then
begin
adodataset1.Close;
adodataset1.CommandText:= 'select * from mima where 用户名=:username ';
self.ADODataSet1.Parameters.ParamByName( 'username ').Value:=combobox1.text;
adodataset1.open;
if ADODataSet1.RecordCount=1 then
begin
if radiobutton1.Checked then
begin
application.MessageBox( '用户名重复,请重新输入! ', '提示信息 ',mb_ok);
combobox1.SetFocus;
end
else
begin
RadioButton4.Checked:=adodataset1.fieldbyname( '权限一 ').asboolean;
RadioButton5.Checked:=adodataset1.fieldbyname( '权限二 ').asboolean;
end;
end
else
begin
if not RadioButton1.Checked then
begin
application.MessageBox( '没有该用户名,请检查! ', '提示信息 ',mb_ok);
combobox1.SetFocus;
end;
end;
adodataset1.close;
end;
end;