Datacolumn type
.NET (Core and Framework)
1
Posts
1
Posters
0
Views
1
Watching
-
I have a Dataset that has returned data from SQL Server. I would like to read in what the SQL Server type is for each Column and what the size is. For instance is the column is a nvarchar(20) I would like to be able to find out that the column has a size of 20. Is this possible? I can't seem to figure this out even using the DataColumn. DataColumn.MaxLength is returning -1. I tried also SQL Command: SELECT COL_LENGTH('MyTable','MyColumnName') AS 'MyColumnLength' it's running fine in SQL Query analyzer but it's returning 0 in C# Any idea? thanks