AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Delphi TmysqlQuery

Ein Thema von question · begonnen am 3. Sep 2013 · letzter Beitrag vom 5. Sep 2013
Antwort Antwort
Seite 1 von 4  1 23     Letzte »    
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

Delphi TmysqlQuery

  Alt 3. Sep 2013, 17:03
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?
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: Delphi TmysqlQuery

  Alt 3. Sep 2013, 17:04
Without the complete Query it's very hard to impossible to help you.
Markus Kinzler
  Mit Zitat antworten Zitat
DonManfred

Registriert seit: 8. Nov 2007
Ort: Düren
55 Beiträge
 
Delphi 10.4 Sydney
 
#3

AW: Delphi TmysqlQuery

  Alt 3. Sep 2013, 19:07
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...
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#4

AW: Delphi TmysqlQuery

  Alt 4. Sep 2013, 08:01
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
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#5

AW: Delphi TmysqlQuery

  Alt 4. Sep 2013, 08:07
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.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#6

AW: Delphi TmysqlQuery

  Alt 4. Sep 2013, 08:43
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?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.542 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: Delphi TmysqlQuery

  Alt 4. Sep 2013, 08:49
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.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#8

AW: Delphi TmysqlQuery

  Alt 4. Sep 2013, 09:08
the field 'Date' is a DateTime field,
  Mit Zitat antworten Zitat
Lemmy

Registriert seit: 8. Jun 2002
Ort: Berglen
2.366 Beiträge
 
Delphi 10.3 Rio
 
#9

AW: Delphi TmysqlQuery

  Alt 4. Sep 2013, 09:19
Hi,

please try this one:

  xxx.ParamByName('Date').AsString := FormatDateTim('yyyy-mm-dd', YourDateValue);
cu
  Mit Zitat antworten Zitat
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#10

AW: Delphi TmysqlQuery

  Alt 4. Sep 2013, 09:36
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);
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 4  1 23     Letzte »    


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:49 Uhr.
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