troubleshooting Question

Stored Procedure Date Parameter

Avatar of Dxpert
DxpertFlag for United States of America asked on
ASP
5 Comments1 Solution314 ViewsLast Modified:
Hey guys...

Here's what i have:

CREATE PROCEDURE sp_Get_CP_ByDate
     @DLR_ID AS nvarchar(255),
     @DATE AS datetime

AS

     SELECT     ID, CP_TYPE, CP_END, CP_TITLE, CP_PRICE
     FROM         koolio.mod_coupon
     WHERE     (SITE_ID =@DLR_ID) AND (cp_begin >= @DATE) AND (cp_end <= @DATE)
GO

* cp_begin and cp_end are "datetime (8)" in the databse
  they contain only date like: 8/14/2002

I am having trouble calling my stored procedure and passing the date:


'set parameters
          set prmObj = cmdObj.CreateParameter("@DLR_ID", 200,1, 255, strDealerId)
          cmdObj.Parameters.Append prmObj
          set prmObj = cmdObj.CreateParameter("@DATE", 135,1,, date)
          cmdObj.Parameters.Append prmObj

I am not sure of what to use for the DataTypeEnum for the @DATE parameter. There it is adDBTimeStamp (135) but it returns no record, even though i have a valid one in the DB.

If i use adDate (7) or adDBDate (133) i get the folloing error:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
[Microsoft][ODBC SQL Server Driver]Optional feature not implemented


Maybe i should change the data type in my table??

Thank you!

ASKER CERTIFIED SOLUTION
stino

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros