I hope someone can help me. I'm trying to pass a date range (from and to) from 2 text boxes on an ASP page to a stored procedure bu the recordset keeps coming back empty
when I know there is at least one record in there. I'm using the ADO command object as follows:
FromDate = CDate(trim(Request.Form("txtFrom_Date"
))
ToDate = CDate(trim(Request.Form("txtTo_Date"
))
'From Date
Set objParam = cmdInvoice.CreateParameter("@FromDate"
objParam.Type = adDBDate
objParam.Direction = adParamInput
objParam.Size = 10
objParam.Value = FromDate
cmdInvoice.Parameters.append objParam
Set objParam = Nothing
'To Date
Set objParam = cmdInvoice.CreateParameter("@ToDate"
objParam.Type = adDBDate
objParam.Direction = adParamInput
objParam.Size = 10
objParam.Value = ToDate
cmdInvoice.Parameters.append objParam
Set objParam = Nothing
With cmdInvoice
.ActiveConnection = Conn
.CommandType = adCmdStoredProc
.CommandText = "sp_GetInvoiceList"
End With
Set rstInvoice = cmdInvoice.Execute(numrecs)
The 2 parameters in the Stored Proc are DateTime Datatypes
If anybody can see why this is not working I would greatly appreciate it
when I know there is at least one record in there. I'm using the ADO command object as follows:
FromDate = CDate(trim(Request.Form("txtFrom_Date"
ToDate = CDate(trim(Request.Form("txtTo_Date"
'From Date
Set objParam = cmdInvoice.CreateParameter("@FromDate"
objParam.Type = adDBDate
objParam.Direction = adParamInput
objParam.Size = 10
objParam.Value = FromDate
cmdInvoice.Parameters.append objParam
Set objParam = Nothing
'To Date
Set objParam = cmdInvoice.CreateParameter("@ToDate"
objParam.Type = adDBDate
objParam.Direction = adParamInput
objParam.Size = 10
objParam.Value = ToDate
cmdInvoice.Parameters.append objParam
Set objParam = Nothing
With cmdInvoice
.ActiveConnection = Conn
.CommandType = adCmdStoredProc
.CommandText = "sp_GetInvoiceList"
End With
Set rstInvoice = cmdInvoice.Execute(numrecs)
The 2 parameters in the Stored Proc are DateTime Datatypes
If anybody can see why this is not working I would greatly appreciate it