[SOLVED]Transaction Control with TTable objects lazarus / 16-Databases ---------------------------------------------------------------------- Knipfty · 2012-08-07 14:43 Hi, While programming last night I came across the following scenario: Code: [Select]Table1.Insert; {FiledByName assignments} Table1.Post; Table2.Insert; {FiledByName assignments} Table2.Post; Table2.Insert;  //Table two gets 2 records inserted (not a typo) {FiledByName assignments} Table2.Post; That is basically what my code looks like.  Now if I were doing this in a stored procedure, I would have added "Begin Transaction" at the start and "Committ" at the end of the code.  But I am doing this in Lazarus.  How can I accomplish this in Pascal/Lararus? ---------------------------------------------------------------------- teos · 2012-08-20 21:39 Transaction is in the Connection or Database component, if implemented. I know for example that ZConnection1.StartTransaction and ZConnection.Commit, ZConnection.Rollback will do what you ask. Normally this is not at the TDataset level. ---------------------------------------------------------------------- Knipfty · 2012-08-21 11:51 Thanks teo, I will take a look at the connection object.  I didn't think to look there.  Hopefully Advantage implemented them. Knipfty ---------------------------------------------------------------------- Knipfty · 2012-08-21 17:11 Hi teo, Code: [Select]  AdsConnection1.BeginTransaction;   AdsConnection1.Commit;   AdsConnection1.Rollback;   AdsConnection1.CreateSavepoint(); I found the above on the connection object.  A Big Thanks! I was looking on the TTable and TQuery objects and getting frustrated.  It just never dawned on me to look at the connection object. I was seriously looking at creating my type of transaction control.  You probably saved me days of work. Knipfty ---------------------------------------------------------------------- JD · 2012-08-21 17:51 @Knipfty I'm interested in knowing what components you are using to connect to the Advantage DB server. ---------------------------------------------------------------------- Knipfty · 2012-08-21 17:59 I downloaded them from Advantage and installed them as a package into the IDE.  See http://devzone.advantagedatabase.com/dz/content.aspx?key =20&Release=18&Product=10&Platform=11  (I believe this is where I downloaded them from) Anyway, I use Advantage locally and for free.  What I really like is the DB Manager that comes with Advantage.  It allows to to easily create and modify tables as I am developing.  It will also output the SQL schema generation code that I plan to use when deploying the application. Does that answer your question? Knipfty ---------------------------------------------------------------------- JD · 2012-08-21 20:18 Quote from: Knipfty on August 21, 2012, 07:59:17 pmI downloaded them from Advantage and installed them as a package into the IDE.  See http ://devzone.advantagedatabase.com/dz/content.aspx?key=20&Release=18&Pro duct=10&Platform=11  (I believe this is where I downloaded them from) Anyway, I use Advantage locally and for free.  What I really like is the DB Manager that comes with Advantage.  It allows to to easily create and modify tables as I am developing.  It will also output the SQL schema generation code that I plan to use when deploying the application. Does that answer your question? Knipfty Yes it does. I see that the Advantage Delphi Components v11 download also includes Lazarus/FPC components. Thanks. ---------------------------------------------------------------------- Knipfty · 2012-08-21 23:56 I just realized I gave you a link to the latest version, v11.  I am using 10.1.  It looks like they made some nice enhancements.  I'm going to have to upgrade and try it out at some point.