The database stores nvarchar, I retrieve the information and I'd like to jam it into C# data types without any declarative conversion code.
Can you implicitly convert nvarchar to C# data types? (e.g. nvarchar to int)
asp.netc++sql
The database stores nvarchar, I retrieve the information and I'd like to jam it into C# data types without any declarative conversion code.
Can you implicitly convert nvarchar to C# data types? (e.g. nvarchar to int)
Best Solution
Nvarchar is a string, if you want to turn it in to a
int
you will have to go through some kind of conversion as I could have "Potato" in the column, whatint
would that map to?Here is a listing of all of the SQL types and what C# types they map to. So if you want a
int
in C# without conversion your only option is aint
in Sql.