Recent

Author Topic: SQLQuery1.ApplyUpdates  (Read 9053 times)

DarkSagara

  • Guest
SQLQuery1.ApplyUpdates
« on: June 21, 2006, 05:48:31 pm »
Hi, i have an problem with connect lazarus(0.9.16) + firebird(1.5), i am using  this components:

+ IBConnection (SQLDB)
+ SQLTransaction (SQLDB)
+ SQLQuery (SQLDB)
+ DataSource (Data Access)
+ DBGrid (Data Controls)
+ DBNavigator (Data Controls)

I see the content of tables, but the changes only in cache, how i can solve this problem ?
how i can make changes in the database file ?

Thanks =]

RudieD

  • Full Member
  • ***
  • Posts: 234
RE: SQLQuery1.ApplyUpdates
« Reply #1 on: June 21, 2006, 07:36:12 pm »
I think you should call SQLTransaction.Commit ?
The FRED Trainer. (Training FRED with Lazarus/FPC)

Anonymous

  • Guest
RE: SQLQuery1.ApplyUpdates
« Reply #2 on: June 21, 2006, 07:53:46 pm »
first thanks for the reply... =]

i have in my project 2 dbedits and 4 buttons, my code:

+ button1.onclick:
   sqlquery1.insert;

+ button2.onclick:
   sqlquery1.delete;
   sqlquery1.applyupdates;
 
+ button3.onclick:
   sqlquery1.post;
   sqlquery1.applyupdates;

+ button4.onclick:
   sqlquery1.cancel;

with this code, i can change the database but only in memory, the database file in hd, is not affected...
when a close the program e open again, the database is clear, how i can solve this ?

Anonymous

  • Guest
RE: SQLQuery1.ApplyUpdates
« Reply #3 on: June 22, 2006, 12:43:44 am »
sqltransaction.Commit;
I think RudieD made the above suggestion.
John

JJurado

  • New member
  • *
  • Posts: 8
SQLQuery1.ApplyUpdates
« Reply #4 on: August 02, 2006, 10:42:18 am »
Hi!

I have the same problem. The only way I found was doing and SQL UPDATE statement when the data changes. But I don't know if there are another better solution.

The SQLTransaction.commit doesn't work

MT

  • Newbie
  • Posts: 4
SQLQuery1.ApplyUpdates
« Reply #5 on: January 06, 2007, 11:30:46 pm »
Hi. I have same problem. My project has two forms. I use same code in form1 and form2 for different tables.  but in form2 when I try SQLQuery1.ApplyUpdates mysql server returns a syntax error. I use DBEdits and I post changes with button because of DBNavigator bug.
Here is the my post code in form1 and form2:
Code: [Select]
procedure TForm2.Button7Click(Sender: TObject);
begin
SQLQuery1.Post;
SQLQuery1.ApplyUpdates;
SQLTransaction1.Commit;
end;


Error:
"An error occured while applying the updates in a record: MySQL50Connection1:
Error executing query: You have an error in your SQL syntax; check
the manual corressponds to your MySQL server version for the right
syntax use near " at line1."

How can I solve this problem?

JanH

  • Guest
SQLQuery1.ApplyUpdates
« Reply #6 on: January 10, 2007, 03:40:11 pm »
I prefer to write a global unit, which only "talk" with the DB. ;-)