Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 4 of 4 total |
Commit Error |
Fri, Feb 27 2015 6:38 AM | Permanent Link |
Uli Becker | I am using this code to update a record in dataset1 and insert a record
in dataset2: -------------------------------------------------- Database.StartTransaction; Dataset1.Update; Dataset1.Columns['LastLogin'].AsDateTime := now; Dataset1.Save; Dataset2.open; Dataset2.insert; Dataset2.columns['PatientenID'].asInteger := 1; Dataset2.save; try Database.Commit; except Database.Rollback; raise ; end; -------------------------------------------------- I get a CommitError with a blank errormessage. HTTP errorcode = 500 JSON seems to be fine. When I split the code and execute this: -------------------------------------------------- Database.StartTransaction; Dataset1.Update; Dataset1.Columns['LastLogin'].AsDateTime := now; Dataset1.Save; try Database.Commit; except Database.Rollback; raise ; end; -------------------------------------------------- and this: -------------------------------------------------- Database.StartTransaction; Dataset2.open; Dataset2.insert; Dataset2.columns['PatientenID'].asInteger := 1; Dataset2.save; try Database.Commit; except Database.Rollback; raise ; end; -------------------------------------------------- both commits work fine when I execute them separately, while executing them together: -------------------------------------------------- Database.StartTransaction; Dataset1.Update; Dataset1.Columns['LastLogin'].AsDateTime := now; Dataset1.Save; try Database.Commit; except Database.Rollback; raise ; end; Database.StartTransaction; Dataset2.open; Dataset2.insert; Dataset2.columns['PatientenID'].asInteger := 1; Dataset2.save; try Database.Commit; except Database.Rollback; raise ; end; -------------------------------------------------- result: only the first statement is executed, no error. I guess it has to to with the asynchronous behaviour of JS. I am doing this in the preview version of EWB2, but since that seems to be a general problem, I post it here. What am I doing wrong and how can I commit multiple changes of my database? thanks Uli |
Fri, Feb 27 2015 6:57 AM | Permanent Link |
Matthew Jones | Uli Becker wrote:
> Dataset2.open; I know nothing of this, but this line makes me ponder. Perhaps the dataset should be open before you start the transaction? -- Matthew Jones |
Fri, Feb 27 2015 7:29 AM | Permanent Link |
Uli Becker | Matthew,
>> Dataset2.open; Thanks. Yes, I forgot to mention, that I already had removed this line - no change though. And: I am using Tim's EWB Server. Uli |
Mon, Mar 2 2015 9:12 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Uli,
<< I get a CommitError with a blank errormessage. HTTP errorcode = 500 JSON seems to be fine. >> Please send me what you're using, and I'll check it out here. I tried something similar in EWB 1 and 2: procedure TForm1.Button1Click(Sender: TObject); begin Database.StartTransaction; try with AnsiCustomer do begin Update; Columns['Company'].AsString:='Updated'; Save; end; with AnsiCustomer1 do begin Open; Insert; Columns['CustNo'].AsInteger:=1200; Columns['Company'].AsString:='Inserted'; Save; end; Database.Commit; except Database.Rollback; raise; end; end; procedure TForm1.Form1Show(Sender: TObject); begin Database.Load(AnsiCustomer); end; In general, the EWB Web Server will shuttle any database exception error messages back to the client EWB application, so you should see a normal error message for primary key errors, etc. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |