diff --git a/public10/ThreeFun/Fun/U_RTFun.pas b/public10/ThreeFun/Fun/U_RTFun.pas index 24fc213..e50b2dd 100644 --- a/public10/ThreeFun/Fun/U_RTFun.pas +++ b/public10/ThreeFun/Fun/U_RTFun.pas @@ -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