Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SqlParameter.SqlDbType behavior
Message
 
 
To
15/03/2016 21:20:33
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01633145
Message ID:
01633149
Views:
36
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform