Why you're not specifying the SqlDbType explicitly?
>When we create a Sql parameter such as:
>
>
>loSqlParameter = New SqlParameter()
>
>
>...this creates loSqlParameter.SqlDbType by default to NVarChar.
>
>Then, if we assign a date value such as '2015-01-01 00:00:00' to loSqlParameter.Value, this will adjust automatically loSqlParameter.SqlDbType to DateTime.
>
>So, up to this point, the SQL data provider is reacting like this.
>
>For years, I was passing a value such as '20150101 00:00:00' from a specific robot task and this was also recognized as a DateTime. Since a few weeks, I found out that our UAT environment was generating errors on that code, with an Invalid column index: "36768", because the default to NVarChar was preserved instead of being adjusted automatically to DateTime as before.
>
>The production does not have the issue.
>
>So, is anyone aware of an update which could have changed the way the SQL data provider reacts? Because, before, I was able to pass a date value, as a parameter, in an ISO format and it would work.
If it's not broken, fix it until it is.
My Blog