Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Answered - Access SQL query in ASP page

Nevermind I answered my own question.

SQL = "SELECT * FROM Tracking where duedue > #" & Date() & "#"

I'm used to using SQL server so I just needed to substitute teh # for '.



"Terry" <snakbrat@yahoo.com> wrote:
>
>I am using an access backend and need to query by current date. For example
>- late items are items where the due date is >= today (current date). My
>sql statement looks like this
>
>SQL = "SELECT * FROM database where duedue >= '" & Date() & "'"
>
>I know that Access has funny little caveats like adding # to the start and
>end of dates but I still cannot seem to get this to work. Can anyone give
>me a hint?
>
>Thanks
>
>I was also thinking that my problem may have something to do with the way
>I am connecting and the type of query I am using - so here's my code if
anyone
>is interested
>
><%
>Dim Conn
>Dim rs
>
>Set Conn = Server.CreateObject("ADODB.Connection")
>Set rs = Server.CreateObject("ADODB.Recordset")
>
>strDatabasePath = Server.MapPath("tracking.mdb")
>Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDatabasePath
>& ";"
>
>SQL = "SELECT * FROM database where duedue >= '" & Date() & "'"
>
>rs.Open SQL, Conn
>
>rs.MoveFirst
>howManyFields = rs.Fields.Count
>Response.Write sql
>%>
>
>
[1604 byte] By [Terry] at [2007-11-9 17:48:57]