通用查询组件设计
前段时间由于工作较忙,无暇整理本组件的相关文档,请大家谅解!以后我会陆续整理公布该组件的所有相关文档及源码!
< AN lang=EN-US>< AN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-ha i-font-family: 'Times New Roman'">设置字段变量 AN>
procedure TMyFieldInfo.SetVariables(d: TDataset);
var
< AN style="mso- acerun: yes"> value : String; AN>
begin
//设置变量值
< AN style="mso- acerun: yes"> if A iU erCase(FilterValue) = 'NULL' then AN>
< AN style="mso- acerun: yes"> exit; AN>
< AN style="mso- acerun: yes"> if FieldType = ftString then AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if CaseSe itive then AN>
< AN style="mso- acerun: yes"> case MatchType of AN>
< AN style="mso- acerun: yes"> fdMatchStart, fdMatchAny : AN>
< AN style="mso- acerun: yes"> value := FilterValue; AN>
< AN style="mso- acerun: yes"> fdMatchEnd : AN>
< AN style="mso- acerun: yes"> value := '%' + FilterValue; AN>
< AN style="mso- acerun: yes"> fdMatchExact : AN>
< AN style="mso- acerun: yes"> value := FilterValue; AN>
< AN style="mso- acerun: yes"> end AN>
< AN style="mso- acerun: yes"> else AN>
< AN style="mso- acerun: yes"> case MatchType of AN>
< AN style="mso- acerun: yes"> fdMatchStart, fdMatchAny : AN>
< AN style="mso- acerun: yes"> value := A iU erCase(FilterValue); AN>
< AN style="mso- acerun: yes"> fdMatchEnd : AN>
< AN style="mso- acerun: yes"> value := '%' + A iU erCase(FilterValue); AN>
< AN style="mso- acerun: yes"> fdMatchExact : AN>
< AN style="mso- acerun: yes"> value := A iU erCase(FilterValue); AN>
< AN style="mso- acerun: yes"> end; AN>
< AN style="mso- acerun: yes"> end AN>
< AN style="mso- acerun: yes"> else AN>
< AN style="mso- acerun: yes"> value := FilterValue; AN>
< AN style="mso- acerun: yes"> if d is TDataSet then AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if MatchType < gt; fdMatchRange then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'Filter').Value := value AN>
< AN style="mso- acerun: yes"> else AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if CaseSe itive then AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if StartingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'Start').Value := StartingValue; AN>
< AN style="mso- acerun: yes"> if EndingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'End').Value := EndingValue; AN>
< AN style="mso- acerun: yes"> end AN>
< AN style="mso- acerun: yes"> else AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if StartingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'Start').Value := A iU erCase(StartingValue); AN>
< AN style="mso- acerun: yes"> if EndingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'End').Value := A iU erCase(EndingValue); AN>
< AN style="mso- acerun: yes"> end; AN>
< AN style="mso- acerun: yes"> end; AN>
< AN style="mso- acerun: yes"> end AN>
< AN style="mso- acerun: yes"> else AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if MatchType < gt; fdMatchRange then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'Filter').Value := value AN>
< AN style="mso- acerun: yes"> else AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if CaseSe itive then AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if StartingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'Start').Value := StartingValue; AN>
< AN style="mso- acerun: yes"> if EndingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'End').Value := EndingValue; AN>
< AN style="mso- acerun: yes"> end AN>
< AN style="mso- acerun: yes"> else AN>
< AN style="mso- acerun: yes"> begin AN>
< AN style="mso- acerun: yes"> if StartingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'Start').Value := A iU erCase(StartingValue); AN>
< AN style="mso- acerun: yes"> if EndingValue < gt; '' then AN>
< AN style="mso- acerun: yes"> TQuery(d).ParamByName(FieldName + 'End').Value := A iU erCase(EndingValue) AN>
< AN style="mso- acerun: yes"> end; AN>
< AN style="mso- acerun: yes"> end; AN>
< AN style="mso- acerun: yes"> end AN>
end;
< AN style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-ha i-font-family: 'Times New Roman'">定义参数变量类 AN>
TDBVariable = cla < AN style="mso- acerun: yes"> // AN>参数数据变量
< AN style="mso- acerun: yes"> public AN>
< AN style="mso- acerun: yes"> VariableName : String // AN>变量名< AN style="mso- acerun: yes"> AN>
< AN style="mso- acerun: yes"> VariableValue : Variant // AN>变量值
< AN style="mso- acerun: yes"> co tructor Create(name : String; value : Variant); // AN>构造函数
< AN style="mso- acerun: yes"> end; AN>
AN>


