Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SqlParameter.SqlDbType behavior
Message
From
15/03/2016 21:20:33
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
SqlParameter.SqlDbType behavior
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:
01633145
Views:
39
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.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform