![]() |
|
#1
|
|||
|
|||
|
I am making a query where I most find a date but i dont know how to pass the date.... this is the code
FModule.Q1.SQL.Add('SELECT DISTINCT Table.date'); FModule.Q1.SQL.Add('WHERE table.date ='); FModule.Q1.SQL.Add(Combo.SelText);<--this is the problem FModulo.Q1.Open; The date on the table is a datetime field, and when i make the query I dont have any answer, and I most pass the information as string..... what can i do in order to the query works correctly.... Help, Help,.....thanks a lot.. |
|
#2
|
|||
|
|||
|
Without trying it myselfe I suppose that this will work ...
SQL.Add('SELECT DISTINCT FROM Table.date WHERE Table.date=' + Combo.Text); Regards /Filip |
|
#3
|
|||
|
|||
|
woops ... Forgot StrToDate(Combo.Text)
Kinda stressed ... ;o) /Filip |
|
#4
|
|||
|
|||
|
Try to convert the date to the US date format MM/DD/YYYY. Some database drivers can't read the international or local date and time formats.
Good luck |
|
#5
|
|||
|
|||
Thaks a lot my friends .....but I have the answer now...i cant conver the string to date because to add the SQL I need a string...... In fact the correct form is to put # example MOdule.Q1.sql.addŽ('where table.date='+'#'+combo.text+'#') thats the form...... I saw the query in access and it have that form...and it is working. |
|
#6
|
|||
|
|||
|
the answere found by you will work though it will slow down the database server
so the better option will be to use the bind variable in query and then assign the value to it on combobbox.change like your can write the query as query.sql.text := 'Select disctinct tableDate from table where tableDate = :dt'; now on query's before open even you can write the following query1.parambyname('dt').value := combobox1.text; now you dont have do do anything else plus there is added advantage because if you are opening the same query again and again then your database need not parse the query string again and again as it remains constant with the result of faster response from it |
![]() |
| Thread Tools | |
| Display Modes | |
|
|