N
Nick B
Help! :{
I have a simple select query in an Access database that has three
parameters. Two are text, one is a date. If I run my query in Access, it
prompts for the date, and two text parameters, I enter them, and they work
fine. However, if I try to run the same thing in ASP, I get an error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
The code I am using is:
Const adCmdStoredProc = &H0004
Const adParamInput = &H0001
Const adVarChar = 200
const adDate = 7
dim cmd
set cmd = server.createobject("adodb.command")
with cmd
.ActiveConnection = "....dsn"
.CommandText = "qryName"
.CommandType = adCmdStoredProc
.Parameters.Append
..CreateParameter("strFName",adVarChar,adParamInput,40,sFirstName)
.Parameters.Append
..CreateParameter("strLName",adVarChar,adParamInput,40,sLastName)
.Parameters.Append
..CreateParameter("dteDate",adDate,adParamInput,255,cDate(tmpDate))
set rsSched = .execute
end with
Now, if I go into the query and set the date criteria to be:
[dteDate]
then it works fine. However, if I set my criteria to be:
I originally had this as an adodb connection with a SQL string,
unfortunately, some of the last names have apostrophes, so this was the only
way I figured I could do it.
Any ideas?
Thanks!
I have a simple select query in an Access database that has three
parameters. Two are text, one is a date. If I run my query in Access, it
prompts for the date, and two text parameters, I enter them, and they work
fine. However, if I try to run the same thing in ASP, I get an error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
The code I am using is:
Const adCmdStoredProc = &H0004
Const adParamInput = &H0001
Const adVarChar = 200
const adDate = 7
dim cmd
set cmd = server.createobject("adodb.command")
with cmd
.ActiveConnection = "....dsn"
.CommandText = "qryName"
.CommandType = adCmdStoredProc
.Parameters.Append
..CreateParameter("strFName",adVarChar,adParamInput,40,sFirstName)
.Parameters.Append
..CreateParameter("strLName",adVarChar,adParamInput,40,sLastName)
.Parameters.Append
..CreateParameter("dteDate",adDate,adParamInput,255,cDate(tmpDate))
set rsSched = .execute
end with
Now, if I go into the query and set the date criteria to be:
[dteDate]
then it works fine. However, if I set my criteria to be:
then it errors out.=[dteDate]
I originally had this as an adodb connection with a SQL string,
unfortunately, some of the last names have apostrophes, so this was the only
way I figured I could do it.
Any ideas?
Thanks!