Is there a way I can define in .NET for any arbitrary SQL Server result set if this column can contain zeros as a result?
For example, if I have statements
Select NullableColumn From MyTable
and
Select IsNull(NullableColumn, '5') as NotNullColumn From MyTable
and I get datareader as follows:
var cmd = new SqlCommand(statement, connection); var rdr = cmd.ExecuteReader();
Can I have such a function?
bool ColumnMayHaveNullData(SqlDataReader rdr, int ordinal) {
I want it to return true for the first statement and false for the second statement.
rdr.GetSchemaTable() does not work for this because it returns if the base column can be null, which I don't want. There are functions in the datareader that return the base type of the sql field, but no one tells me if it can be null.
dan
source share