Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Date to a Stored Proc from an ASP page

Status
Not open for further replies.

Lftsk

Programmer
Jul 11, 2002
25
US
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
 
why not just do this

Set rstInvoice = conn.execute("EXEC cmdInvoice '" & request("txtFromDate") & "','" & request("txtToDate") & "'")

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top