You have previously stated EMONTH is an integer in your DB (values are 1-12)
So you can't query it using a string value as in:
EMONTH=' " & strCat &" ' "
You must use an integer value as in
EMONTH=" & strCat
(of course strcat is really an integer so it should be renamed accordingly as intCat)
You have previously been informed YEAR is a Reserved word and Can not be use for a Field name
(as in: rs("YEAR")
- rename your DB field name to say EYEAR and make it an integer (values like: 2007)
catname is the same month as intCat (but in text) so there is no need for it to be a querystring at all
And your query does not include any reference to the sort parameter cat
- when you limit the data to the month there is no need to sort by the month
- if you have a field in your DB for the day (say named EDAY as an integer) you could sort by day in the month
A query string link to your page w/ a parameter would be then (for 4th month - April in year 2007 ) would be:
http://ruidosonow.com/events_listtest.asp?cat=4&yr=2007
Your page code would be:
<%
intCat = Request.Querystring("cat") 'Tells which month to display
If intCat="" THEN intCat= Month(Date()) 'Make sure we have some Month value
intYr = Request.Querystring("yr") 'Tells which year to display
If intYr="" THEN intYr= Year(Date()) 'Make sure we have some Year value
catname=" " & Ucase(MonthName(intCat),False))) & " " & intYr 'Set Text for Month/Year
strSql="SELECT * FROM events WHERE EMONTH="& intCat & " AND EYEAR=" & intYr
' Or if EDAY is a numeric day field in the DB
'strSql="SELECT * FROM events WHERE EMONTH="& intCat & " AND EYEAR=" & intCat
& " ORDER BY EDAY ASC"
set rs = conn.Execute(strSql)
%>
<%=catname 'Display catname%>
<% 'Display records Here %>
Strongly suggest you study how to use ASP at say
http://www.w3schools.com/asp/default.asp
and
http://www.w3schools.com/ado/default.asp
and
http://www.w3schools.com/sql/default.asp
_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
_____________________________________________
| Ok I think I know what is going on. I am not asking to sort by month.
| I do not need that. I just need the code to get curent month from
| strCat which will then access the database for that monbth. I think it
| will do it now . Here is what the code looks like now. Does anybody
| see a problem with this?
|
| ' opens database
| dim strCat, catname
|
| strCat = request.querystring("cat")'tells which month to sort by
| catname = request.querystring("catname")
|
| if strCat = "" then
| strCat=MonthName(Month(Date()),False)
| catname=Ucase(strCat)
| end if
|
| set rs = conn.Execute("SELECT * FROM events WHERE EMONTH= ' "& strCat
| &" ' ")
|
| %>
|
| <%= " " & catname & (" " & rs("YEAR"))%>
|
| page for testing
http://ruidosonow.com/events_listtest.asp
|
| thanks again
|
|
| > Then you need numeric delimiters in your SQL (w/o the ' ')
| > - below is all on 1 line
| >
| > set rs = conn.Execute("SELECT * FROM events WHERE EMONTH=" & intCat & " ORDER by EMONTH ASC")
| >
| > --
| >
| > _____________________________________________
| > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > "Warning - Using the F1 Key will not break anything!" (-;
| > _____________________________________________
| >
| >
| > | Field Name is: EMONTH data type is numeric as you suggested earlier.
| > |
| > | thanks
| > |
| > |
| > | > What is the name and data type of the Field in your DB
| > | > - the data you are passing must match it in type and field name
| > | >
| > | > --
| > | >
| > | > _____________________________________________
| > | > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > "Warning - Using the F1 Key will not break anything!" (-;
| > | > _____________________________________________
| > | >
| > | >
| > | > | As usual with these things I got another error:
| > | > |
| > | > | Microsoft JET Database Engine error '80040e14'
| > | > |
| > | > | Syntax error (missing operator) in query expression 'EMONTH='.
| > | > |
| > | > | Any ideas?
| > | > |
| > | > | thanks again.
| > | > |
| > | > |
| > | > | > set rs = conn.Execute("SELECT * FROM events WHERE EMONTH=" & intCat &"
| > | > | > ORDER by EMONTH ASC)
| > | > | >
| > | > | > should be
| > | > | >
| > | > | > set rs = conn.Execute("SELECT * FROM events WHERE EMONTH=" & intCat & "
| > | > | > ORDER by EMONTH ASC")
| > | > | >
| > | > | > --
| > | > | > Ron Symonds - Microsoft MVP (FrontPage)
| > | > | > Reply only to group - emails will be deleted unread.
| > | > | > FrontPage Support:
http://www.frontpagemvps.com/http://www.rxs-enterprises.org/fp
| > | > | >
| > | > | >
| > | > | >| > | > | >
| > | > | > > I must be missing some syntax. I am getting an error message.
| > | > | >
| > | > | > > Microsoft VBScript compilation error '800a0409'
| > | > | >
| > | > | > > Unterminated string constant
| > | > | >
| > | > | > > set rs = conn.Execute("SELECT * FROM events WHERE EMONTH=" & intCat &"
| > | > | > > ORDER by EMONTH ASC)
| > | > | >
| > | > | > > page is here:
http://ruidosonow.com/events_listtest.asp
| > | > | >
| > | > | > > thanks for your help.
| > | > | >
| > | > | > > > If you want the current month use:
| > | > | >
| > | > | > > > <%
| > | > | > > > strCat=MonthName(Month(Date()),False)
| > | > | > > > catname=Ucase(strCat)
| > | > | > > > %>
| > | > | >
| > | > | > > > FYI
| > | > | > > > MonthName(Month(Date()),True) would give you the month abbreviated
| > | > | >
| > | > | > > > PS
| > | > | > > > MONTH is a reserved word and should Not be used as a DB field name
| > | > | > > > - rename it to say Emonth
| > | > | > > > Same applies to YEAR (rename it to say Eyear)
| > | > | > > > Seehttp://sqlserver2000.databases.aspfaq.com/what-are-reserved-access-od...
| > | > | >
| > | > | > > > You really should consider storing the event month an integer (1-12) in the DB as say Emonth
| > | > | > > > - will help you sort months correctly
| > | > | > > > <%
| > | > | > > > intCat=Month(Date())
| > | > | > > > catname=Ucase(MonthName(intCat,False))
| > | > | > > > %>
| > | > | > > > then your query would be
| > | > | > > > set rs = conn.Execute("SELECT * FROM events WHERE Emonth=" & intCat &" ORDER by Emonth ASC)
| > | > | >
| > | > | > > > _____________________________________________
| > | > | > > > SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
| > | > | > > > "Warning - Using the F1 Key will not break anything!" (-;
| > | > | > > > _____________________________________________
| > | > | >
| > | > | >
| > | > | > > > |I need some help with some ASP code to change the month automatically
| > | > | > > > | and pull info from a calendar database. I am currently updating the
| > | > | > > > | Month (strCat and catname) each month. Here is the code I am using
| > | > | > > > | now:
| > | > | > > > |
| > | > | > > > |
| > | > | > > > | if strCat = "" then
| > | > | > > > | strCat = "April"
| > | > | > > > | catname = "APRIL"
| > | > | > > > | end if
| > | > | > > > |
| > | > | > > > | set rs = conn.Execute("SELECT * FROM events WHERE MONTH = '"& strCat
| > | > | > > > | &"'")
| > | > | > > > |
| > | > | > > > | %>
| > | > | > > > |
| > | > | > > > | <%= " " & catname & (" " & rs("YEAR")) %>
| > | > | > > > |
| > | > | > > > | The page is here:
| > | > | > > > |
| > | > | > > > |
http://ruidosonow.com/events.asp
| > | > | > > > |
| > | > | > > > | thanks
| > | > | > > > |
| > | > |
| > | > |
| > | > |
| > | > |
| > |
| > |
|
|
|
|