On 04/06/2013 10:19, Antonio Fortuny wrote:
Le 04/06/2013 09:56, Eric Kom a écrit :
Good day all;

I am trying to set the Active property of TSQLTransaction to False so that I can avoid the above Read Error message:
SQLTransaction: Operation cannot be performed on an active transaction
The True value is currently set to True.

Try SQLTransaction.Commit or SQLTransaction.RollBack instead, depending on the case. Afterwards you can do whatever you need with the transaction. Do not use the Retaining methods as they do not desactivate the transaction. If the underlying database is Firebird, use Commit preferably to RollBack unless the former job has to be really rollbacked.
Thanks, I did changed to Commit and then caNone before it solved the error, another error message pop up saying Access Violation. Anyway, the problem was solved.

The above code its giving me a problem; the SQLQuery do not changed according to the condition for exemple if the first condition matched, the second condition is still going to use the matching from the first and vice versa.

         else if  (cbbList.Items[cbbList.ItemIndex] = lisList1) then begin
              DataModuleConn.SQLTransaction1.Active:=True;
DataModuleConn.SQLQuery1.SQL.Text:='SELECT year, country, gender FROM reiser WHERE country = ''Dutch Republic''';
              DBGrid1.DataSource.DataSet:=DataModuleConn.SQLQuery1;
              DBGrid1.DataSource:=DataModuleConn.Datasource;
              DBGrid1.DataSource.DataSet.Active:=True;
              //DataModuleConn.SQLTransaction1.Commit;
              DataModuleConn.SQLTransaction1.CommitRetaining;
         end
         else if  (cbbList.Items[cbbList.ItemIndex] = lisList1) then begin
              DataModuleConn.SQLTransaction1.Active:=True;
DataModuleConn.SQLQuery1.SQL.Text:='SELECT year, country, gender FROM reiser WHERE country = ''Holland''';
              DBGrid1.DataSource.DataSet:=DataModuleConn.SQLQuery1;
              DBGrid1.DataSource:=DataModuleConn.Datasource;
              DBGrid1.DataSource.DataSet.Active:=True;
              //DataModuleConn.SQLTransaction1.Commit;
              DataModuleConn.SQLTransaction1.CommitRetaining;
         end;

I have tried DataModuleConn.SQLTransaction1.Rollback also, still the same.

Antonio.


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



--
Kind Regards

Eric Kom

System Administrator & Programmer - Metropolitan College
 _________________________________________
/ You are scrupulously honest, frank, and \
| straightforward. Therefore you have few |
\ friends.                                /
 -----------------------------------------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (| Kom | )
    /'\_   _/`\
    \___)=(___/

2 Hennie Van Till, White River, 1240
Tel: 013 750 2255 | Fax: 013 750 0105 | Cell: 078 879 1334
[email protected] | [email protected]
www.kom.za.net | www.kom.za.org | www.erickom.co.za

Key fingerprint: 513E E91A C243 3020 8735 09BB 2DBC 5AD7 A9DA 1EF5


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to