How to pass datetime parameter to SQL7 Stored Procedure using VB 
Author Message
 How to pass datetime parameter to SQL7 Stored Procedure using VB

I have a stored procedure which retrieve a parameter of datetime like


AS....

and in VB

I use cmd as Command and cn as connection which can connect to SQL7
Cmd.CommandText = "INSERTRECORD"
Cmd.CommandType = adCmdStoredProc
set Cmd.ActiveConnection = cn
CmdTest.Parameters.Append CmdTest.CreateParameter("DTTime", adDate,
adParamInput, 8, DateValue(Now))
Cmd.Execute

but it returns an error
[ODBC SQL Driver]: Optional feature not implemented

pls help
thx



Tue, 09 Sep 2003 17:13:41 GMT  
 How to pass datetime parameter to SQL7 Stored Procedure using VB
I am also having this problem, if you take out the 8 attribute, it will get rid of this error, but then you'll
get a '[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to datetime' message.

I can't seem to pass dates to a stored procedure at all.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 18 Oct 2003 20:54:33 GMT  
 How to pass datetime parameter to SQL7 Stored Procedure using VB
This is the workaround I use.  The stored procedure has its parameter type
of DateTime but the parameter is set to adVarChar and formatted like so:

    With cmCommand
        Set prmMod = .CreateParameter("EndDate", adVarChar, adParamInput,
19, Format$(md{*filter*}d, "mm/dd/yyyy hh:mm:ss"))
    End With

Home that helps

In His Love
scott


Quote:
> I am also having this problem, if you take out the 8 attribute, it will

get rid of this error, but then you'll
Quote:
> get a '[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting

data type varchar to datetime' message.
Quote:

> I can't seem to pass dates to a stored procedure at all.

> *** Sent via Developersdex http://www.*-*-*.com/ ***
> Don't just participate in USENET...get rewarded for it!



Wed, 22 Oct 2003 02:32:36 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing parameter from Crystal OCX to a report that uses a stored procedure

2. Passing parameters into stored procedure using Data Environment

3. How to passing parameters from and to a SQL Server stored procedure using ADO

4. Pass Null to stored procedure parameter using ADO?

5. ADO/SQL7 Stored Procedure with parameters problem

6. Passing Parameters to stored parameter queries using VB 5's Data Controls

7. SQL7 stored procedure string parameter error on NT4.0

8. Calling SQL7 stored procedure containing parameters

9. problem passing the data from ASP to a stored procedure in SQL7.0

10. problem passing the data from ASP to a stored procedure in SQL7.0

11. datetime parameter from CR7 to a stored procedure in sqlserver2000

12. DATETIME - SQL Stored Procedure - Crystal Parameters

 

 
Powered by phpBB® Forum Software