retrieving data from a database smallint column that may be null
Posted on 2008-06-17
I don't program in c# so i hope you might be able to help me on this.
I need to retrieve data from a databse which is contained in a datareader. One of the columns in the reader, call it index 0, is of type smallint and it might have a value of null. what type of variable do i need to store this? Perhaps its nullable of int but i don't know how to use one of these in c#. Also how do i check the column value is not null before i retrieve it from the reader using something like myvar = reader.getInt16(0)
thanks a lot