ADO Parameters and DATEs 
Author Message
 ADO Parameters and DATEs

I am trying to pass a date into a SP from VB and ADO.  If there is no date
my create parameter statement returns an error.  Here is the create
parameter line:

    cmd.Parameters.Append cmd.CreateParameter("SaleDate", adDBDate,
adParamInput, 4, Format(sSaleDate, "{##/##/####}"))

The date type in the sql server is smalldatetime.  The error I am getting is
"Application uses a value of the wrong type for the current operation".  I
have tried adDate for the type and I get the same results.  sSaleDate is
Null in the cases where an error returns.

Thanks for any help in advance.


Sun, 12 Oct 2003 02:56:26 GMT  
 ADO Parameters and DATEs
I haven't checked a smalldatetime field, but you may want adDBTimestamp.

You can always use the Data View window to look up the ADO datatype
equivalent for the fields in your database and be sure it's right the first
time without guessing.

You can also use the Stored Procedure Add-in download to help you with the
tedious parameter coding.

Sun, 12 Oct 2003 06:26:06 GMT  
 [ 2 post ] 

 Relevant Pages 

1. ADO Date parameter error

2. ADO Command Date parameter: idiocy

3. Date type parameter in ADO command

4. Can't pass a NULL date parameter via ADO to SQL stored procedure

5. Crystal Reports 8.5 date range parameter field - record selection that includes null date range

6. ADO with Access Date/Time field not storing the time, just the date

7. Using ADO w/ADO data control date problems

8. ADO Date Fields (ADO 2.1, VB 6, Oracle 8)

9. Optional Date Parameters

10. Date format in QueryDef parameters?

11. Optional Date Parameter Bug!

12. Parameter Fields for dates


Powered by phpBB® Forum Software