我在Visual Studio中使用GridView并向其添加自定义SQL查询。
SELECT
[Type], [YogaType], [ReservationTime], [ReservationDate],
[SpacesLeft], [Cancelled], [SessionID]
FROM
[Reservation]
WHERE
(([CustomerID] = ?)
AND ([ReservationDate] > #?#)
OR ([ReservationDate] = #?# AND ([ReservationTime] > #?#)))
填写引号的信息来自会话。当我尝试测试它时会出现以下错误。
查询表达式中日期中的语法错误'(([CustomerID] =?)AND([ReservationDate]>#?#)或([ReservationDate] =#?#AND([ReservationTime]>#?#) )'。
任何想法出了什么问题?我无法调试ASPX页面,无法设置断点已经尝试过。我正在使用MS Access数据库
答案 0 :(得分:0)
我已经设法弄清楚了,在访问和查询构建器中使用了很多测试,这是有效的SQL查询:
SELECT [Type], [YogaType], [ReservationDate], [ReservationTime], [SpacesLeft], [Cancelled], [SessionID] FROM [Reservation] WHERE (([CustomerID] = ?) AND ([ReservationDate] > ?) OR ([ReservationDate] = ? AND ([ReservationTime] > ?)));