Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get column's SqlDbType
Message
 
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01578221
Message ID:
01578233
Vues:
46
>Hi everybody,
>
>I made a few searches in StackOverflow but I haven't found a good clean solution yet.
>
>The problem - I need to know the SqlDbType of the column (not its .NET type).
>
>We have our own code which I don't like and which returns incorrect results (it returns NVarchar type (when checking String type)) but we only have Varchar type in our database.
>
>So, I am wondering if you have a clean bullet proof code that returns SqlDbType when you pass column name (as a String) and a table name (as a String) (in our case we don't need to pass schema as we use dbo only).
>
>Thanks a lot in advance.
>
>----------------
>The solution I looked at StackOverlow is
>
>http://stackoverflow.com/questions/7470258/how-to-get-the-sqltype-of-a-column-in-a-datatable (and the link from it)

Wow, a bit more googling seems to bring the answer!

http://msmvps.com/blogs/egoldin/archive/2006/12/20/programmatically-determining-the-sqldbtype-of-a-field.aspx
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform