diff --git a/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md b/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md index 3af65e81..55fb5e27 100644 --- a/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md +++ b/SanPinPLM/相关操作/4.0-other/999.Delphi脚本记录.md @@ -622,3 +622,26 @@ end. ## 根据输入内容在数据库中查询,获取查询结果作为下拉列表以供选择 +```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 + + //注释:在下面添加您的脚本代码 + str := fedtusr_sqlmj.Text; + if Length(str) > 0 then + begin + if Length(chiGetFieldValueBySql('select top 1 usr_sqlmj from pdmitem where usr_sqlmj like ''%' + str + '%''')) > 0 then + begin + chiFillComboBox('select distinct top 10 usr_sqlmj from pdmitem where usr_sqlmj like ''%' + str + '%''',fedtusr_sqlzc); + end + else + begin + chiFillComboBox('select ''''',fedtusr_sqlzc); + end; + end; +end. + +``` \ No newline at end of file