Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.04.04;
Скачать: CL | DM;

Вниз

Что за параметры требуются для выполнения Execute в KOLSLQuery   Найти похожие ветки 

 
Armaniak ©   (2003-07-25 12:06) [0]

Собственно весь вопрос. Не смог найти по хелпам.
Заранее спасибо.


 
Boguslaw   (2003-07-25 19:52) [1]

Hello,

   function Open(Params : array of const) : Integer;
   {* Execute SQL query returning resultset}

   function Execute(Params : array of const) : Integer;
   {* Execute SQL query without returning resultset (Note: use RowID to find last inserted row
   for example to establish foreign key relation)}

Params = array of const
You must read about this in Delphi help.
This is of course something that needs change, but as nobody really take attention to it I assume that this object is not needed by anyone.
I always use this to put params into SQL statement. You must allocate strings variables for each param and pass it to Open or Execute like this:

procedure TDataMod.ChangeUser(Nr : Integer);
var
Iden : String;
begin
   try
   Iden := Int2Str(Nr);
   with QWorking^ do begin
       Close;
       SQL.Clear;
       SQL.Add("SELECT NR_PRACOWNIKA,IMIE || "" "" || NAZWISKO AS DANEOS,NAZWA_STANOWISKA AS STANOWISKO,");
       SQL.Add("ADMIN,POP3,SMTP,USER,PASSWORD,EMAIL");
       SQL.Add(" FROM STANOWISKA");
       SQL.Add(" INNER JOIN PRACOWNICY USING(NR_STANOWISKA) WHERE NR_PRACOWNIKA =%Q");
       if Open([Iden]) <> 0 then Exit;
       First;
       if RowCount <> 1 then Exit;
       NrPrac := Str2Int(SField[0]);
       Admin := StrEq("T",SField[3]);
       POP3 := SField[4];
       SMTP := SField[5];
       USER := SField[6];
       PASSWORD := SField[7];
       ADR_MAIL := SField[8];
       DaneOsobowe := SFieldByName["DANEOS"] + CrLf + SFieldByName["Stanowisko"];
   end;
   finally
   QWorking.Close;
   end;
end;

Note that each %Q or %q must be represented by param in Params array:
SQL = select source form repository when cathegory=%Q and date < %Q

var
s1,s2 : String;
begin
s1 := "KOL";
s2 := DecodeDateToStringInFormat???(Now); //2003-01-03 (yyyy-mm-dd);
SLQuery.Open[s1,s2];


Regards
Boguslaw



 
Boguslaw   (2003-07-27 17:11) [2]

Actually I think that You can also use %d statement for integer variables and other format parameters but I"m not sure .
Try
select * from sometable where thing=%d

and Open([V]) function

where V is integer variable.

This solution is powerfull (just change V value and Open again!) but not compatible with SQL standard.


 
Armaniak ©   (2003-07-28 05:11) [3]

Спасибо, ещё раз. Обязательно попробую.



Страницы: 1 вся ветка

Текущий архив: 2004.04.04;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.034 c
4-1075291202
Guest_2004
2004-01-28 15:00
2004.04.04
ShowWindow(Application.Handle,SW_HIDE)


1-1079437821
PaR
2004-03-16 14:50
2004.04.04
Работа с текстом...


14-1078573376
Delphi5.01
2004-03-06 14:42
2004.04.04
Слышал что существует программа для чистой записи на компьютер!


1-1079429042
ПрогерШ
2004-03-16 12:24
2004.04.04
Как уменьшить размер екзешника?


1-1079498494
Malax
2004-03-17 07:41
2004.04.04
Копирование и запуск приложения