calling procedure from vb script with datetime as one of the input parameter 
Author Message
 calling procedure from vb script with datetime as one of the input parameter

Hi,

I'm calling a SQL Server store procedure which takes datetime as one of the
input paramater.  So I took it as a string instead from the input and cast
it into datetime data type format, but VB is still complaining.

the code:

dateStr = "November 23, 2002"
dateStr1 = "October 01, 1999"
theDate = CDate(dateStr)
theDate1 = CDate(dateStr1)

set rs = db.Execute("dbo.mb_test_procedure theDate, theDate1, 66, 100")

When the execute command is executed it complaint saying:
   "Syntax error converting datetime from character string"

the Data Type of the inputs for the store procedure is nvarchar(20).  I have
changed it to varchar(20) and it still doesn't work.  Can someone help

Thanks
Henry



Sat, 08 Jan 2005 03:17:29 GMT  
 calling procedure from vb script with datetime as one of the input parameter
Shouldn't the Execute have the dates concatenated in?  Like this:

set rs = db.Execute("dbo.mb_test_procedure " + theDate + ", " + theDate1 +
", 66, 100")

Tim and Wendy
Microsoft Visual Basic Development Team

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Quote:
> Hi,

> I'm calling a SQL Server store procedure which takes datetime as one of
the
> input paramater.  So I took it as a string instead from the input and cast
> it into datetime data type format, but VB is still complaining.

> the code:

> dateStr = "November 23, 2002"
> dateStr1 = "October 01, 1999"
> theDate = CDate(dateStr)
> theDate1 = CDate(dateStr1)

> set rs = db.Execute("dbo.mb_test_procedure theDate, theDate1, 66, 100")

> When the execute command is executed it complaint saying:
>    "Syntax error converting datetime from character string"

> the Data Type of the inputs for the store procedure is nvarchar(20).  I
have
> changed it to varchar(20) and it still doesn't work.  Can someone help

> Thanks
> Henry



Tue, 11 Jan 2005 04:26:46 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Calling one VB Script from another VB Script

2. How to pass datetime parameter to SQL7 Stored Procedure using VB

3. ado recordsets from stored procedures, stored procedures have input parameters

4. input parameter is datetime type.

5. input parameter is datetime type.

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

7. DATETIME - SQL Stored Procedure - Crystal Parameters

8. Override datetime parameter from stored procedure

9. Calls to Procedures Using VB Declare Statement Apparently Has Scope Issues (Reply to This One)

10. Passing Array as Input Parameter to Oracle Stored Procedure

11. Help: SubReport based on Stored procedure with an input parameter

12. Input Parameter for Stored Procedure

 

 
Powered by phpBB® Forum Software