Re: Запрос между датами в MS Access
От: pkarklin  
Дата: 21.09.06 04:54
Оценка:
Здравствуйте, Аноним, Вы писали:

А>Пишу на дельфях, к базе MS Access подключаюсь через ADO

А>Не могу правильно написать запрос....


А>
А>select * from MainTable where [date] between 12.09.2006 00:00:00 and 12.09.2006 23:59:59
А>


А>формат таблицы колонки [date] такой же (полный формат)


А>почему всегда выходит ошибка синтаксиса?



А>пробывал и так

А>
А>select * from MainTable where [date] between #12.09.2006 00:00:00# and #12.09.2006 23:59:59#
А>


А>не помогает... в чем может быть дело?


When you specify the criteria argument, date literals must be in U.S. format, even if you are not using the U.S. version of the Microsoft® Jet database engine. For example, May 10, 1996, is written 10/5/96 in the United Kingdom and 5/10/96 in the United States. Be sure to enclose your date literals with the number sign (#) as shown in the following examples.

To find records dated May 10, 1996 in a United Kingdom database, you must use the following SQL statement:

SELECT *

FROM Orders

WHERE ShippedDate = #5/10/96#;


You can also use the DateValue function which is aware of the international settings established by Microsoft Windows®. For example, use this code for the United States:

SELECT *

FROM Orders

WHERE ShippedDate = DateValue('5/10/96');


And use this code for the United Kingdom:

SELECT *

FROM Orders

WHERE ShippedDate = DateValue('10/5/96');
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.