Skip to content Skip to sidebar Skip to footer

Table Valued Parameter Issue With Mono Cs

I have a simple code to create SqlParameter for Table Valued Type. The given code works just fine with .NET 4.0. Issue is with MONO CS (3.12.0), I cannot simply compile the same co

Solution 1:

MONO SqlParameter class does not expose TypeName property but it is there in the source code.

So, I have used Reflection to set value to TypeName property:

SqlParametertValue=newSqlParameter("@dr" + _tableName, _dt);
 tValue.SqlDbType = SqlDbType.Structured;

 System.Reflection.PropertyInfopropertyInfo= tValue.GetType().GetProperty("TypeName");
 propertyInfo.SetValue(tValue, "dbo.factoryItem", null);

Post a Comment for "Table Valued Parameter Issue With Mono Cs"