Skip to content

Commit

Permalink
UDT columns have type_name=NULL (DBNull). Bug in code tried to do thi…
Browse files Browse the repository at this point in the history
…s: (string) DBNull.Value
  • Loading branch information
jfollas committed Apr 12, 2012
1 parent 6005a77 commit 9c71cc2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Simple.Data.SqlServer/SqlSchemaProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public IEnumerable<Column> GetColumns(Table table)

private static Column SchemaRowToColumn(Table table, DataRow row)
{
var sqlDbType = row.IsNull("type_name") ? SqlDbType.Udt : DbTypeFromInformationSchemaTypeName((string)row["type_name"]);
SqlDbType sqlDbType = SqlDbType.Udt;

if (!row.IsNull("type_name"))
sqlDbType = DbTypeFromInformationSchemaTypeName((string)row["type_name"]);

var size = (short)row["max_length"];
switch (sqlDbType)
{
Expand Down

0 comments on commit 9c71cc2

Please sign in to comment.