Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SqlParameter.SqlDbType behavior
Message
 
 
À
15/03/2016 21:20:33
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01633145
Message ID:
01633149
Vues:
35
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform