TZQuery problem Delphi 6

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
ejla
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 25.10.2006, 07:55

TZQuery problem Delphi 6

Post by ejla »

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 ;
BigLuis
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 12.10.2006, 11:13
Location: España

TZquery and dates in MySQL.

Post by BigLuis »

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.......
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

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
ejla
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 25.10.2006, 07:55

Post by ejla »

Hi and thanks,
well I see that its problem with something else but query... :oops:
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.
ejla
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 25.10.2006, 07:55

Post by ejla »

ejla wrote:Hi and thanks,
well I see that its problem with something else but query... :oops:
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.
All OK again... I take away TZTable and use TZQuery's updateSQL instead. Everything work fine and much more faster than B4.
Post Reply