private void UpdateStrQuery() { string tmpFilter; if (_Filter.Length > 0) { tmpFilter = _Filter; } else { tmpFilter = "1=1"; } string TmpStr = DataPersistance.BuildKeyField(td); if (_OrderFld._dtlsa == null) { strQuery = string.Concat("SELECT KeyField FROM (SELECT ", TmpStr, " AS KeyField,", _OrderFld.FieldName, " FROM ", td._TableName, " WHERE (", tmpFilter, ")) AS X"); _CriteriaPos = strQuery.Length - 6; } else { strQuery = string.Concat("SELECT KeyField FROM (SELECT KeyField,", DataPersistance.GetSqlCoalesceNoFormat(_OrderFld.FieldName, DataPersistance.FormatSqlValue(string.Empty)), " AS ", _OrderFld.FieldName, " FROM (SELECT ", TmpStr, " AS KeyField,(", _OrderFld._dtlsa._SqlQuery, ") AS ", _OrderFld.FieldName, " FROM ", td._TableName, " WHERE (", tmpFilter, ")) AS X) AS X"); _CriteriaPos = strQuery.Length - 12; } IsKeyFieldEqualOrderField = TmpStr == _OrderFld.FieldName; }