I have a SQL Server stored procedure which accepts a datetime parameter to filter it's resulting data by. This has the following statement declared at the start:
Code:
SET DATEFORMAT dmy
Through the SQL Query Analyzer, I can run this stored procedure, using either of the following, and receive results:
Code:
SET @FromDate = '30-12-2004 00:01:01:001'
SET @FromDate = '30/12/2004'
Placing exactly the same strings in the following code within vb.net, produces a "String was not recognized as a valid DateTime." exception message! Can someone please explain how I can pass a date value into the SQLClient.SQLCommand object successfully???
VB Code:
  1. cmdSQL = New SqlClient.SqlCommand
  2.  
  3. cmdSQL.Parameters.Add("@FromDate", SqlDbType.DateTime).Value= ?????
  4. cmdSQL.Parameters.Item(0).Direction = ParameterDirection.Input

Thanks!!