通用查詢組件設計
前段時間由于工作較忙,無暇整理本組件的相關文檔,請大家諒解!以后我會陸續整理公布該組件的所有相關文檔及源碼!
PRocedure TMyFieldInfo.SetVariables(d: TDataset);
var
value : String;
begin
//設置變量值
if AnsiUpperCase(FilterValue) = 'NULL' then
exit;
if FieldType = ftString then
begin
if CaseSensitive then
case MatchType of
fdMatchStart, fdMatchAny :
value := FilterValue;
fdMatchEnd :
value := '%' + FilterValue;
fdMatchExact :
value := FilterValue;
end
else
case MatchType of
fdMatchStart, fdMatchAny :
value := AnsiUpperCase(FilterValue);
fdMatchEnd :
value := '%' + AnsiUpperCase(FilterValue);
fdMatchExact :
value := AnsiUpperCase(FilterValue);
end;
end
else
value := FilterValue;
if d is TDataSet then
begin
if MatchType <> fdMatchRange then
TQuery(d).ParamByName(FieldName + 'Filter').Value := value
else
begin
if CaseSensitive then
begin
if StartingValue <> '' then
TQuery(d).ParamByName(FieldName + 'Start').Value := StartingValue;
if EndingValue <> '' then
TQuery(d).ParamByName(FieldName + 'End').Value := EndingValue;
end
else
begin
if StartingValue <> '' then
TQuery(d).ParamByName(FieldName + 'Start').Value := AnsiUpperCase(StartingValue);
if EndingValue <> '' then
TQuery(d).ParamByName(FieldName + 'End').Value := AnsiUpperCase(EndingValue);
end;
end;
end
else
begin
if MatchType <> fdMatchRange then
TQuery(d).ParamByName(FieldName + 'Filter').Value := value
else
begin
if CaseSensitive then
begin
if StartingValue <> '' then
TQuery(d).ParamByName(FieldName + 'Start').Value := StartingValue;
if EndingValue <> '' then
TQuery(d).ParamByName(FieldName + 'End').Value := EndingValue;
end
else
begin
if StartingValue <> '' then
TQuery(d).ParamByName(FieldName + 'Start').Value := AnsiUpperCase(StartingValue);
if EndingValue <> '' then
TQuery(d).ParamByName(FieldName + 'End').Value := AnsiUpperCase(EndingValue);
end;
end;
end
end;
 
TDBVariable = class //參數數據變量
public
VariableName : String; //變量名
VariableValue : Variant; //變量值
constructor Create(name : String; value : Variant); //構造函數
end;
新聞熱點
疑難解答