SQL and ASP variables (a.k.a this is driving me insane)
-
I am using this statement to return some records. The statement using the ASP variable ActiveID to pull records according to categories. This works fine, but I can't seem to add further variables (e.g. How would I add an ORDER BY statement to this?) RS1.Open "SELECT * FROM Table WHERE Cat_ID =" & ActiveID, DB1, adopenstatic What I really want to do is return records updated in the last seven days or so. I have the last modified value stored in a table in the format DD/MM/YY -- is it possible to do a SQL query that will only return records updated in the past seven days?
-
I am using this statement to return some records. The statement using the ASP variable ActiveID to pull records according to categories. This works fine, but I can't seem to add further variables (e.g. How would I add an ORDER BY statement to this?) RS1.Open "SELECT * FROM Table WHERE Cat_ID =" & ActiveID, DB1, adopenstatic What I really want to do is return records updated in the last seven days or so. I have the last modified value stored in a table in the format DD/MM/YY -- is it possible to do a SQL query that will only return records updated in the past seven days?
Garth wrote: How would I add an ORDER BY statement to this?)
RS1.Open "SELECT * FROM Table WHERE Cat_ID =" & ActiveID & " ORDER BY Name", DB1, adopenstatic
-- David Wengier Sonork ID: 100.14177 - Ch00k
-
I am using this statement to return some records. The statement using the ASP variable ActiveID to pull records according to categories. This works fine, but I can't seem to add further variables (e.g. How would I add an ORDER BY statement to this?) RS1.Open "SELECT * FROM Table WHERE Cat_ID =" & ActiveID, DB1, adopenstatic What I really want to do is return records updated in the last seven days or so. I have the last modified value stored in a table in the format DD/MM/YY -- is it possible to do a SQL query that will only return records updated in the past seven days?
this should get records updated only in the last seven days as well but I haven't checked this yet as I'm late for work :D strSql = "" strSql = strSql & "SELECT * FROM Table WHERE Cat_ID =" & ActiveID strSql = strSql & " AND modifiedDate >= '"& DateAdd("d", now(), -7) &"' ORDER BY modifiedDate " RS1.Open strSql, DB1, adopenstatic HTH