I'm working with Delphi 6 with 6.5.1. alpha CSV.
A query below don't return right data from MySQL 4.1 database.
The resultset is filtered ONLY by date, but all arrivals with respective arrival date will be in the resultset.
What mad?
code:
[font=Courier New]query := 'select * from booking where b_date = "' +
edArrDate.Text + '"' +
' and arrTime = "' + edArrTime.Text +'"' ;[/font]
sql1.Sql.Clear;
Sql1.Sql.Add(query);
sql1.Open ;
TZQuery problem Delphi 6
Moderators: gto, cipto_kh, EgonHugeist
TZquery and dates in MySQL.
I dont know exactly the answer but try to use parameters like "SELECT * from table where date_field=:dDate and time_field=:tTime;
var
myDate:Tdate;
myTime:TTime;
myDate:=strtodate(edit1.text).
query.parambyname('ddate').asdatetime:=myDate;
Anyway I think you have to pass the date in the correct format when you do it directly from a text box "YYYY/MM/DD" because when you pass the date like a variable i think Delphi format it aumaticly.
If I program like a write I shall never finish a program.......
var
myDate:Tdate;
myTime:TTime;
myDate:=strtodate(edit1.text).
query.parambyname('ddate').asdatetime:=myDate;
Anyway I think you have to pass the date in the correct format when you do it directly from a text box "YYYY/MM/DD" because when you pass the date like a variable i think Delphi format it aumaticly.
If I program like a write I shall never finish a program.......
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi Ejla,
Did you check the resulting 'query' variable and pasted that query in the mysql console to check the result? Maybe the format of date and time are not exactly as mysql expects them.
Also, you may drop a ZSQLMonitor component in your project and use it to log the actual queries sent to the server to a flat file. That result must give the right result in mysql console.
Let us know how you do.
(And try the beta version, it already had some fixes after 2005)
Mark
Did you check the resulting 'query' variable and pasted that query in the mysql console to check the result? Maybe the format of date and time are not exactly as mysql expects them.
Also, you may drop a ZSQLMonitor component in your project and use it to log the actual queries sent to the server to a flat file. That result must give the right result in mysql console.
Let us know how you do.
(And try the beta version, it already had some fixes after 2005)
Mark
All OK again... I take away TZTable and use TZQuery's updateSQL instead. Everything work fine and much more faster than B4.ejla wrote:Hi and thanks,
well I see that its problem with something else but query...
I'm usin editable TDBGrid and its source is TZTable (called ResultSet...) The MasterSource for the TZTable is dsSQL1 (from TZQuery).
TZQuery seems work OK, but someting between TZQuery & TZTable.