I am learning ASP and am messing about with a database that contains Menu items for a cafe (Main Courses etc).
I have managed to display all of the database contents (currently four lines of data) which is simply a table that has Date (date/Time); MainCourse (Text); Vegetable (Text); Fruit (Text); Dessert (text) as fields. The first record contains todays date (currently 03/11/2002) followed by three other consecutive days.
However when I want to view just todays date (currently 03/11/2002) I get an error.
Here is the code:
<%
Dim Connect, OnMenu, Today, Query,
Set Connect = Server.createObject("ADODB.Connection"
Connect.open "Menu"
Today = CStr(Date)
Query = "SELECT * FROM Menu WHERE Date = #" & Today & "#"
Set OnMenu = Connect.Execute(Query)
%>
<Font Size=5>Today:<%=OnMenu("Date"
%></Font><br>
Main Course:<%=OnMenu("MainCourse"
%></Font><br>
Vegetables:<%=OnMenu("Vegetable"
%></Font><br>
Fruit:<%=OnMenu("Fruit"
%></Font><br>
Dessert:<%=OnMenu("Dessert"
%></Font><br>
When run I get this
Time:
...as I would expect but then this is followed by the error...
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
?
I am guessing that this means that the data with todays date assigned to it in the database cannot be found.
When using <%=Date%> todays date IS displayed in the browser and there IS a date in the database table with the exact same date and in the same format.
Example:
the <%=Date%> displays 03/11/2002 and the data in the Date field in the database is also 03/11/2002
Thanks in advance for any help you can give me to correct this problem.
Peter
I have managed to display all of the database contents (currently four lines of data) which is simply a table that has Date (date/Time); MainCourse (Text); Vegetable (Text); Fruit (Text); Dessert (text) as fields. The first record contains todays date (currently 03/11/2002) followed by three other consecutive days.
However when I want to view just todays date (currently 03/11/2002) I get an error.
Here is the code:
<%
Dim Connect, OnMenu, Today, Query,
Set Connect = Server.createObject("ADODB.Connection"
Connect.open "Menu"
Today = CStr(Date)
Query = "SELECT * FROM Menu WHERE Date = #" & Today & "#"
Set OnMenu = Connect.Execute(Query)
%>
<Font Size=5>Today:<%=OnMenu("Date"
Main Course:<%=OnMenu("MainCourse"
Vegetables:<%=OnMenu("Vegetable"
Fruit:<%=OnMenu("Fruit"
Dessert:<%=OnMenu("Dessert"
When run I get this
Time:
...as I would expect but then this is followed by the error...
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
?
I am guessing that this means that the data with todays date assigned to it in the database cannot be found.
When using <%=Date%> todays date IS displayed in the browser and there IS a date in the database table with the exact same date and in the same format.
Example:
the <%=Date%> displays 03/11/2002 and the data in the Date field in the database is also 03/11/2002
Thanks in advance for any help you can give me to correct this problem.
Peter