procedure SetRange(const StartValues, EndValues: array of const);

Алексей Ходыкин
Дата: 26.05.2011 11:53:39
D7
Перевожу программу с BDE на MS SQL SERVER 2005 (точнее 13 программ )
Имеется код
    Table2.SetRange([Form1.Table1.FieldByName('sch').asString, ComboBox3.Text],
                    [Form1.Table1.FieldByName('sch').asString, ComboBox3.Text]);
    Table2.ApplyRange;
Table2 проиндексирована по полю sch.
sch - char(20)

Поменял тип компонентов на ADO.

читаем справку:
автор
Delphi syntax:
procedure SetRange(const StartValues, EndValues: array of const);
C++ syntax:
void __fastcall SetRange(const System::TVarRec * StartValues, const int StartValues_Size, const System::
TVarRec * EndValues, const int EndValues_Size);
Description

Call SetRange to specify a range and apply it to the dataset.
The new range replaces the currently applied range, if any.
StartValues indicates the field values that designate the first
record in the range. StartValues_Size specifies the index of the
last value in StartValues (one less than the total number of values).
EndValues indicates the field values that designate the last record
in the range. EndValues_Size specifies the index of the last value in
EndValues (one less than the total number of values).
SetRange combines the functionality of SetRangeStart, SetRangeEnd,
and ApplyRange in a single procedure call. SetRange performs the following functions:

1 Puts the dataset into dsSetKey state.
2 Erases any previously specified starting range values and ending range values.
3 Sets the start and end range values.
4 Applies the range to the dataset.

If either StartValues or EndValues has fewer elements than the number
of fields in the current index, then the remaining entries are set to NULL.
After a call to SetRange, the cursor is left on the first record in the range.
Note: With Paradox or dBASE tables, SetRange works only on indexed fields.
With SQL databases, SetRange also works with any columns specified in the
IndexFieldNames property.

Теперь я так понял единственный вариант сделать фильтрацию чз filter (если не менять на TADOQuery ест-но).
Вопрос: как это сделать?
если бы было например так
    Table2.SetRange([Form1.Table1.FieldByName('sch').asString], [ComboBox3.Text]);
    Table2.ApplyRange;
,то вопроса у меня бы не возникло. а так не пойму как происходит фильтрация при 4-х значениях,
и как следствие не получается составить условие для Table.filter.
Заранее спасибо.
Michael Longneck
Дата: 26.05.2011 12:09:00
between если KeyExclusive = False и >= =< если иначе. Что тут не понимать?
Anatoly Podgoretsky
Дата: 26.05.2011 12:18:54
Какой еще Table
Алексей Ходыкин
Дата: 26.05.2011 13:04:30
Anatoly Podgoretsky
Какой еще Table

TTable
RENaissance
Дата: 26.05.2011 13:07:35
Алексей Ходыкин
Anatoly Podgoretsky
Какой еще Table

TTable

Используй TAdoDataset с фильтрацией в запросе.
Anatoly Podgoretsky
Дата: 26.05.2011 13:09:03
Алексей Ходыкин
Anatoly Podgoretsky
Какой еще Table

TTable

Выброси каку иначе все бессмысленно.
Алексей Ходыкин
Дата: 26.05.2011 13:25:03
Michael Longneck
between если KeyExclusive = False и >= =< если иначе. Что тут не понимать?

а что разве between и >= =< не одно и то же?
что-то я видимо не понял
напишите пожалуйста условия для фильтра, заодно мне дойдёт зачем там 4 параметра
Алексей Ходыкин
Дата: 26.05.2011 14:28:41
Бояннизд02
with Table1 do
    begin
      Filter:= 'sch between '+ Form1.Table1.FieldByName('sch').asString+' and ' + quotedstr(ComboBox3.Text)
                 + ' and '+ 'sch between '+ Form1.Table1.FieldByName('sch').asString+' and ' + quotedstr(ComboBox3.Text); 
      Filtered:=true;
    end

всем спасибо
всё оказывается намного проще чем я думал