Actually, we’re facing a problem when exectuting SQL UPDATE when we have a field with text content with “:” character. Follow the code snippet on Oxygene project:
{
Comunication
}
daconn : IAbstractConnection;
method TDAADOConn.execSQL (sql: String): Integer;
var cmd : IDbCommand;
begin
try
cmd := daconn.NewCommand(sql);
Result := cmd.ExecuteNonQuery;
When executed a UPDATE like that:
UPDATE TABLE T SET T.MESSAGE = “Today is: 05/05/2021 01:04:05” WHERE T.ID = 1;
After parse NewCommand(sql), the text changes from “Today is: 05/05/2021 01:04:05” to “Today is@ 05/05/2021 01@04@05” and apply to the database.
On other hand, an INSERT preserve the Original Text, passing by the same command!
Is there some command to preserve the Original text? Keeping : instead replace it to @?
OS Version: Windows 10
DataAbstract Version: RemObjects Data Abstract for Water and Visual Studio, Server Edition - 10.0.0.1495
IDE: Visual Studio 2019 and Water.
DataBase: MySQL 5.7 using DB Connector: mysql-connector-net-8.0.25
For My SQL you need to use ' to define string literals, not "
Also it is highly recommended to use parametrized commands instead of plain string concatenation. Otherwise your code might have the SQL Injection vulnerability.