![]() |
Delphi TmysqlQuery
Hi,
I am using Tmysqlquery and TmySqlUpdateSQL to update(insert/delete/modify) the database concring user input, but i get the error "you have an error in your sql syntax near 'OC2000000A000000201' EmySqldatabase error" i have checked several times the query and database connection, everything is fine but i dont have any idea why i get this error do you have any idea? |
AW: Delphi TmysqlQuery
Without the complete Query it's very hard to impossible to help you.
|
AW: Delphi TmysqlQuery
Zitat:
LOG it for debugging purposes. Or maybe post the query here... |
AW: Delphi TmysqlQuery
as i have used tmysqlquery instead TQuery ,therefore I have one idea, it can happend becasue of tmysqlquery component?
here is the code for insert (it is from dfm)
Code:
modify
insert into TableAdd
(Name, Address, Phone, Emial, Date) values (:Name, :Address, :Phone, :Emial, :Date)
Code:
delete
update TableAdd
set Name= :Name, Address= :Address, Phone= :Phone, Emial= :Emial, Date= :Date where ID = :OLD_ID
Code:
delete from TableAdd
where ID = :ID |
AW: Delphi TmysqlQuery
What happens when you quote the fieldnames?
Code:
At least "Date" is quite surely a reserved word because there is a corresponding data type.
insert into TableAdd
(`Name`, `Address`, `Phone`, `Emial`, `Date`) values (:Name, :Address, :Phone, :Emial, :Date) |
AW: Delphi TmysqlQuery
I have tried as you suggested even i have also tried by changing the name of the date field
Code:
but still have the same error, by the way,how can i check System.DateTime value and MySql.Data.Types.MySqlDate, maybe the datetime of the system and the mysqlDate is not matching, its just my idea,what do you think?
insert into TableAdd
(`Name`, `Address`, `Phone`, `Emial`, `Date`) values (:Name, :Address, :Phone, :Emial, :Date) |
AW: Delphi TmysqlQuery
SQL-Parameters are usually parsed automatically. Maybe your field is a timestamp instead of a Date/DateTime? It is hard to find a solution when you don' t know either the table structure nor the Delphi-code used to execute your queries.
|
AW: Delphi TmysqlQuery
the field 'Date' is a DateTime field,
|
AW: Delphi TmysqlQuery
Hi,
please try this one:
Delphi-Quellcode:
xxx.ParamByName('Date').AsString := FormatDateTim('yyyy-mm-dd', YourDateValue);
cu |
AW: Delphi TmysqlQuery
the querystring is done by using dfm with field and parameter
how can i use
Code:
xxx.ParamByName('Date').AsString := FormatDateTim('yyyy-mm-dd', YourDateValue);
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:46 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz