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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Dates to a Stored Procedure - Help!

Status
Not open for further replies.

debunky

Programmer
Mar 12, 2002
14
US
I have an Informix stored procedure that needs 4 parameters: whse (3), cust (6), begin date & end date. I suspect the dates are giving me problems. When using the .Parameter with ADO how should I be defining the date? I have the #'s around them but do I need something else? Nowhere can I find any examples. Here is my code:

Set cn = New ADODB.Connection
Set cmdFullPallet = New ADODB.Command
cn.Open "mydsn"
cmdFullPallet.CommandText = "fullpallet"
cmdFullPallet.CommandType = adCmdStoredProc


Set prmWhse = cmdFullPallet.CreateParameter("warehouse", adChar, adParamInput, 3)
cmdFullPallet.Parameters.Append prmWhse
prmWhse.Value = "410"

Set prmCust = cmdFullPallet.CreateParameter("customer", adChar, adParamInput, 6)
cmdFullPallet.Parameters.Append prmCust
prmCust.Value = "1414"

Set prmBeginDate = cmdFullPallet.CreateParameter("begin_date", adDate, adParamInput)
cmdFullPallet.Parameters.Append prmBeginDate
prmBeginDate.Value = #1/1/2002#

Set prmEndDate = cmdFullPallet.CreateParameter("end_date", adDate, adParamInput)
cmdFullPallet.Parameters.Append prmEndDate
prmEndDate.Value = #5/21/2002#


cmdFullPallet.ActiveConnection = cn
cmdFullPallet.Execute




Any suggestions? Thanks.
 
Sorry, I don't know much about Informix, but have met a problem with SQL Server and dates whilst calling stored procedures, hopefully it might help.

The adDate type is not recognised and doesn't work!, however if you use the adDBTimeStamp instead the date is sucessfully passed to the stored procedure.

It's probably worth a try.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top