|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I would like to filter my Access DB which has a table named "events" by a column named "category". Within the column, I have five "event" catagories in which I would like to filter the Event table by.
Here I have opened the DB: dsn="DBQ=" & Server.Mappath("admin/o12cal.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};" Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open dsn Here is my attempt to filter the Events: <%Set RSDATE = Server.CreateObject("ADODB.Recordset") SQLDATE = "SELECT * FROM Events WHERE Category = dance AND (Month(Date) = Month('"&dateSelect&"')) AND (Year(Date) = Year('"&dateSelect&"')) AND (Day(Date) = Day('"&dateSelect&"'))" RSDATE.Open SQLDATE, Conn, 1, 3 That statement brings up an ASP error: Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. Any suggestions? Thanks pr |
|
#2
|
|||
|
|||
|
This page has a few suggestions:
http://www.aspfaq.com/show.asp?id=2128. Also, with access you need to surround the date variable with the # key http://www.aspfaq.com/show.asp?id=2040 Is your field name called date? Last edited by aspnewbie : May 6th, 2003 at 05:55 PM. |
|
#3
|
|||
|
|||
|
got it!
I solved it.
<%Set RSDATE = Server.CreateObject("ADODB.Recordset")SQLDATE = "SELECT * FROM Events WHERE Category = 'theater' AND (Month(Date) = " & Month(dateSelect) & ") AND (Year(Date) = " & Year(dateSelect) & ") AND (Day(Date) = " & Day(dateSelect) & ")" RSDATE.Open SQLDATE, Conn, 1, 3 do while NOT RSDATE.EOF%> thanks |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > SQL syntax for filtering a table by a column |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|