version 2004
MySQL_Execute (connID; statement)
| Parameter | Type | Description | |
| connID | Longint | Connection ID returned by MySQL_Connect | |
| statement | Text | SQL statement to execute |
Description
The MySQL_Execute command executes SQL statements.
connID is a Longint returned from MySQL_Connect.
statement is a text introducing the SQL statement (e.g. "INSERT INTO mytable (name, date) VALUES ('Doe', '2005-06-10')").
Call the MySQL_ErrorCode method to determine whether the method succeeded or failed. If it returns 0, then the SQL statement executed successfully.
Examples
(1) This example shows a basic use of this command:
MySQL_Execute(connID;"UPDATE clients SET good_one='Yes' WHERE zip_code='90210'")
(2) This example inserts variable values into the Clients column:
MySQL_AddIntegerParameter(connID;"%1";4578) MySQL_AddStringParameter(connID;"%2";"Boeing Corp") MySQL_AddRealParameter(connID;"%3";95798.90) MySQL_AddTextParameter(connID;"%4";"It's a test") MySQL_Execute(connID;"INSERT INTO clients (num, name, amount, comment) VALUES (%1, %2, %3, %4)") If(MySQL_ErrorCode(connID)#0) ALERT(MySQL_ErrorString(connID)) Else `Statement executed End if