Hello Everyone,
A have a Managed Stored Procedure ([Microsoft.SqlServer.SqlProcedure]). In it I would like to call a UserDefinedFunction:
public static SqlInt32 IsGetSqlInt32Null(SqlDataReader dr, Int32 index)
{
if(dr.GetSqlValue(index) == null)
return SqlInt32.Null;
else
return dr.GetSqlInt32(index)
}
I than allways get the following ErrorMessage:
Column, parameter, or variable #1: Cannot find data type SqlDatareader.
Is it not possibel to pass the SqlDatareader to a SqlFunction, do the reading there and return the result.
My original Problem is, that datareader.GetSqlInt32(3) throws an error in case there is Null in the DB. I thought SqlInt32 would allow Null.
Would appreciate any kind of help! Thanks
You may need to refer to the SqlDataReader with full qualified name if you haven't using the proper namespace:
System.Data.SqlClient.SqlDataReader
No comments:
Post a Comment