Monday, March 2, 2015
C SQLCLR SqlMetaData with SqlDbType Float column getting InvalidCastException on SqlDataRecord SetFloat
Trying to set the value using the SetFloat Method, i got an InvalidCastException.
How-i-fixed-it:
I found out that SqlDbType.Float is equal to a System.Double data type. Using the SetDouble Method it works fine.
Here i found the right hints:
http://msdn.microsoft.com/de-de/library/vstudio/system.data.sqldbtype(v=vs.80).aspx
http://msdn.microsoft.com/de-de/library/vstudio/microsoft.sqlserver.server.sqldatarecord.setfloat.aspx
http://msdn.microsoft.com/de-de/library/vstudio/microsoft.sqlserver.server.sqldatarecord.setdouble.aspx
Labels:
c,
column,
float,
getting,
invalidcastexception,
on,
setfloat,
sqlclr,
sqldatarecord,
sqldbtype,
sqlmetadata,
with
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment