vinod kadam
July 28th, 2000, 01:38 AM
The following error showed up on running an asp script that contain the following sql
sql -> Select * from SubOrDefBugDetails where Datediff("y",DefectDate,Now)
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Anyone ,please tell me how to correct it?
Johnny101
July 28th, 2000, 11:21 AM
my guess is that when you put this sql statement into a string - the "s around the Y, they screwed it up.
also, you can't include the datediff and val functions in the query.
try this instead:
dim sql
sql = "Select * from SubOrDefBugDetails where " & Datediff("y",DefectDate,Now) & " < 1000"
'you would have to have DefectDate declared somewhere. if its a column name in the
'table, then you will have to change the query to read
sql = "select * from SubOrDefBugDetails where (Datediff(yy,DefectDate,getdate()) < 1000)"
then the first query, after processing, would look like:
Select * from SubOrDefBugDetails where 432 < 1000
but, i have to say, if the datediff function returns a number less than 1000, all the records in the table will be brought back. i'm wondering if that is what your are looking for.
the second query will do what i'm thinking your wanting. if the bug was reported less than 1000 units ago, then bring it back as part of the recordset. this will also be a dynamic value. are you looking for years, days, months, minutes or what? the y parameter isn't valid in SQL Server, but yy indicates years.
anyway- hope this helps,
john
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org