vault backup: 2025-05-07 19:48:34
This commit is contained in:
@ -121,4 +121,44 @@ begin
|
||||
fedtDrawId.Text := '';
|
||||
end;
|
||||
end.
|
||||
```
|
||||
|
||||
## 执行SQL语句获取查询结果
|
||||
|
||||
主要内容为通过 `chiGetFieldValueBySql方法去执行 ` SQL ` 语句
|
||||
|
||||
```Delphi
|
||||
uses MyClass,Variables,BaseUtil,CommonFunc,DataConst,CFFrm,CFSimplePropFrm,Forms,StdCtrls,Variants,SysUtils,Classes,Controls,Dialogs,
|
||||
CHostIntf,ProductClas,DocClas,LoginClas,VirtualTrees,CEntClas,PathClas;
|
||||
|
||||
Var
|
||||
str: String;
|
||||
begin
|
||||
try
|
||||
// 1. 查询usr_333的值
|
||||
str := chiGetFieldValueBySql('select usr_333 from pdmitem where itemcode = ''' + fedtItemCode.Text + '''');
|
||||
|
||||
// 2. 检查查询结果
|
||||
if str = '' then
|
||||
begin
|
||||
ShowMessage('未找到物料编码: ' + fedtItemCode.Text);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// 3. 如果usr_333为1,则更新usr_444为1
|
||||
if str = '1' then
|
||||
begin
|
||||
// 执行更新操作
|
||||
cbxusr_444.checked := false;
|
||||
|
||||
// 可选:显示操作成功提示
|
||||
ShowMessage('已自动将usr_444更新为1');
|
||||
end;
|
||||
|
||||
except
|
||||
on E: Exception do
|
||||
ShowMessage('操作失败: ' + E.Message);
|
||||
end;
|
||||
end.
|
||||
|
||||
```
|
Reference in New Issue
Block a user