🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.pascal
2 messages
2 total messages Started by Koriolan Sat, 31 Jul 2010 19:43
Lazarus i SQLQuery.
#93084
Author: Koriolan
Date: Sat, 31 Jul 2010 19:43
26 lines
1443 bytes
Jak zmusić SQLQuery do zmian ? Update, Insert itp.
Szukałem po necie ale przykłady mi nie działąją.
Nie chcę tu opisywać co mi się nie udało ale np.

==============
With SQLQuer ...

       UpdateSQL.Clear;  //Clear Update SQL Statement if Any
       UpdateSQL.Add('update pit_tmp_zm'); 
                   //
       UpdateSQL.Add('set kod_gl=''101010'' ');   //Create SQL
       UpdateSQL.Add('where pit_id= 10;'); 
            //
       ExecSQL;
       Edit; //Put Query in Edit(Update) Mode
       Post;
       ApplyUpdates; //Post and Apply Updates
       Close;
       SQLTrans1.CommitRetaining;
       ....

================

Nie działa :-(
Generalnie czepia się, że nie ma SQL (jest Update) ExecSQL zamiast Open
też nie chodzi :-(
Re: Lazarus i SQLQuery.
#93085
Author: Koriolan
Date: Mon, 16 Aug 2010 15:43
35 lines
1634 bytes
Koriolan pisze:
> Jak zmusić SQLQuery do zmian ? Update, Insert itp.
> Szukałem po necie ale przykłady mi nie działąją.
> Nie chcę tu opisywać co mi się nie udało ale np.
> ......[CIACH]
> Nie działa :-(
> Generalnie czepia się, że nie ma SQL (jest Update) ExecSQL zamiast Open
> też nie chodzi :-(

Poradziłem sobie ..

Operowanie SQLQuery przy operacjach innych niż 'SELECT' wychodzi mi tak :

--------------------------

procedure TModyfik1.ButtDoCennikaClick(Sender: TObject);
begin
   // Dodaj Lek do Cennika
   WITH DataModule1 DO BEGIN
     if SQLTransaction3.Active then SQLTransaction3.Commit;
     SQLQuery3.close;
     SQLQuery3.SQL.clear;
     SQLQuery3.SQL.Add('INSERT INTO pit_zm ( data_zm) VALUES ( 
''2010-01-01'');');
     SQLTransaction3.StartTransaction;
     SQLQuery3.ExecSQL;
     SQLTransaction3.Commit;
    END;
end;

---------------------------

Działa :-)

Koriolan
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads