Page 1 of 1
TMyQuery->ExecSQL() substitute?
Posted: Fri 29 Aug 2008 14:47
by Minotaurus007
For SELECT-statements I use
For UPDATE-statements I used to use
in another software package.
Switching to MyDAC however, this method seems to be not available. What is the correct method to run UPDATE statements after creating an SQL-String like
Code: Select all
MyQuery1->SQL->Text = "UPDATE table SET column = 1 WHERE ...";
Being unsure now I tried MyQuery1->Execute(); but I'd appreciate to get some valid advice.
-Mino
Re: TMyQuery->ExecSQL() substitute?
Posted: Fri 29 Aug 2008 17:47
by eduardosic
Minotaurus007 wrote:For SELECT-statements I use
For UPDATE-statements I used to use
in another software package.
Switching to MyDAC however, this method seems to be not available. What is the correct method to run UPDATE statements after creating an SQL-String like
Code: Select all
MyQuery1->SQL->Text = "UPDATE table SET column = 1 WHERE ...";
Being unsure now I tried MyQuery1->Execute(); but I'd appreciate to get some valid advice.
-Mino
You can use MyQuery1.Execute for all SQL (Selec, Update, Delete, Create... )
see MyDAC Help;
Code: Select all
Description
Use Execute to execute the SQL statement on the server. If SQL statement is a query, Execute calls Open method.
Execute implicitly prepares the SQL statement by calling Prepare method if AutoPrepare option is set to True and the statement has not been prepared yet. To speed up the performance in case of multiple Execute calls, an application should call Prepare before calling Execute method for the first time.
Posted: Fri 29 Aug 2008 18:20
by Minotaurus007
You can use MyQuery1.Execute for all SQL (Selec, Update, Delete, Create... )
Thx, Eduard. I was confused because for UPDATE queries MYSQL explicitely requires ExecSQL(). Execute() works in MyDAC for me now.
Posted: Fri 29 Aug 2008 18:24
by eduardosic
Minotaurus007 wrote:You can use MyQuery1.Execute for all SQL (Selec, Update, Delete, Create... )
Thx, Eduard. I was confused because for UPDATE queries MYSQL explicitely requires ExecSQL(). Execute() works in MyDAC for me now.
No problems this is normal when starting with MyDAC.
goog look
