增加InitAdoData,修改InitCDSData 方法,多选框选择问题

This commit is contained in:
sgwp 2024-11-12 11:05:43 +08:00
parent 0f56332ecd
commit fa72f24442

View File

@ -218,6 +218,7 @@ procedure LSCSHData(ADOQueryTmp: TADOQuery; mParent: TdxLayoutControl; FTag: Int
procedure LRTSetsavedata(ADOQueryCmd: TADOQuery; MyTable: string; Myparent: TdxLayoutControl; MyTag: Integer);
function SLGetFilters(layoutControl: TdxLayoutControl; EquTag, LikeTag: Integer): string;
procedure InitAdoData(ADO1: TADOQuery; Tv1: TcxGridDBTableView; SqlStr, FilterStr, MarkStr: string);
// **************** ʦүдµÄ *****************//
type
@ -2178,34 +2179,66 @@ procedure InitCDSData(ADO1: TADOQuery; CDS1: TclientDataSet; Tv1: TcxGridDBTable
var
MarkStrValue: string;
begin
if trim(MarkStr) <> '' then
begin
if not CDS1.IsEmpty then
MarkStrValue := TRIM(CDS1.FieldByName(MarkStr).AsString);
try
Tv1.BeginUpdate() ;
if trim(MarkStr) <> '' then
begin
if not CDS1.IsEmpty then
MarkStrValue := TRIM(CDS1.FieldByName(MarkStr).AsString);
end;
with ADO1 do
begin
Close;
SQL.Clear;
sql.Add(SqlStr);
Open;
end;
if trim(FilterStr) <> '' then
SDofilter(ADO1, FilterStr);
SCreateCDS(ADO1, CDS1);
SInitCDSData(ADO1, CDS1);
Tv1.DataController.Filter.Refresh;
if trim(MarkStr) <> '' then
CDS1.Locate(MarkStr, MarkStrValue, []);
finally
tv1.EndUpdate;
end;
end;
//////////////////////////////////////
procedure InitAdoData(ADO1: TADOQuery; Tv1: TcxGridDBTableView; SqlStr, FilterStr, MarkStr: string);
var
MarkStrValue: string;
begin
try
Tv1.BeginUpdate();
if trim(MarkStr) <> '' then
begin
if not ADO1.IsEmpty then
MarkStrValue := TRIM(ADO1.FieldByName(MarkStr).AsString);
end;
with ADO1 do
begin
Close;
SQL.Clear;
Filtered := false;
sql.Add(SqlStr);
Open;
end;
if trim(FilterStr) <> '' then
SDofilter(ADO1, FilterStr);
Tv1.DataController.Filter.Refresh;
if trim(MarkStr) <> '' then
ADO1.Locate(MarkStr, MarkStrValue, []);
finally
Tv1.EndUpdate();
end;
with ADO1 do
begin
Close;
SQL.Clear;
Filtered := false;
sql.Add(SqlStr);
// ShowMessage(sql.text);
Open;
end;
if trim(FilterStr) <> '' then
SDofilter(ADO1, FilterStr);
SCreateCDS(ADO1, CDS1);
SInitCDSData(ADO1, CDS1);
Tv1.DataController.Filter.Refresh;
if trim(MarkStr) <> '' then
CDS1.Locate(MarkStr, MarkStrValue, []);
end;
procedure SInitRadioGroupBySql(ADOQueryTmp: TADOQuery; rg: TRadioGroup; emptyFlag: Boolean; mSql: string);
begin
with ADOQueryTmp do