Delphi-PRAXiS
Seite 1 von 4  1 23     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Delphi TmysqlQuery (https://www.delphipraxis.net/176416-delphi-tmysqlquery.html)

question 3. Sep 2013 17:03

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?

mkinzler 3. Sep 2013 17:04

AW: Delphi TmysqlQuery
 
Without the complete Query it's very hard to impossible to help you.

DonManfred 3. Sep 2013 19:07

AW: Delphi TmysqlQuery
 
Zitat:

Zitat von question (Beitrag 1227068)
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"

The problem is not the databaseconnection. The problem is the SQL-Query you are using.

LOG it for debugging purposes. Or maybe post the query here...

question 4. Sep 2013 08:01

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:
insert into TableAdd
  (Name, Address, Phone, Emial, Date)
values
  (:Name, :Address, :Phone, :Emial, :Date)
modify
Code:
update TableAdd
set
  Name= :Name,
  Address= :Address,
  Phone= :Phone,
  Emial= :Emial,
  Date= :Date
where
  ID = :OLD_ID
delete
Code:
delete from TableAdd
where
  ID = :ID

DeddyH 4. Sep 2013 08:07

AW: Delphi TmysqlQuery
 
What happens when you quote the fieldnames?
Code:
insert into TableAdd
  (`Name`, `Address`, `Phone`, `Emial`, `Date`)
values
  (:Name, :Address, :Phone, :Emial, :Date)
At least "Date" is quite surely a reserved word because there is a corresponding data type.

question 4. Sep 2013 08:43

AW: Delphi TmysqlQuery
 
I have tried as you suggested even i have also tried by changing the name of the date field
Code:
insert into TableAdd
  (`Name`, `Address`, `Phone`, `Emial`, `Date`)
values
  (:Name, :Address, :Phone, :Emial, :Date)
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?

DeddyH 4. Sep 2013 08:49

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.

question 4. Sep 2013 09:08

AW: Delphi TmysqlQuery
 
the field 'Date' is a DateTime field,

Lemmy 4. Sep 2013 09:19

AW: Delphi TmysqlQuery
 
Hi,

please try this one:

Delphi-Quellcode:
  xxx.ParamByName('Date').AsString := FormatDateTim('yyyy-mm-dd', YourDateValue);

cu

question 4. Sep 2013 09:36

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 22:54 Uhr.
Seite 1 von 4  1 23     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz