Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, August 5, 2008 4:04 PM
There is a column defined as tinyint. What's matching datatype in VB?
All replies (4)
Tuesday, August 5, 2008 4:14 PM
It's Byte
http://msdn.microsoft.com/en-us/library/ms131092.aspx
Tuesday, August 5, 2008 4:22 PM
Thanks. But how to get the value? For other type, you can get the the value as the way(for example, for integer
ReturnValue = dr.GetSqlInt32(dr.GetOrdinal(FieldName)).Value
But for Byte, following code is not correct:
ReturnValue = dr.GetByte(dr.GetOrdinal(FieldName)).Value
because there is no Value for Byte.
Tuesday, August 5, 2008 4:27 PM
returnValue = dr.GetByte(i)
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getbyte.aspx
Tuesday, August 5, 2008 5:15 PM
Byte.TryParse(dr.getByte(index))
Hope this helps
DK