Reputation: 389
I have an OracleDataReader object in vb.net that contains a column holding a Long (which is text in oracle). I need to get it into a datagridview, whenever I try to bind it through a datatable, or convert a single item with .toString I end up with an empty string.
I realize that the column could potentially hold way more text than can be put in the datagrid, I'm okay with cutting off some, or losing some in the conversion because I really only need the first part of it.
Database changes are not an option. Anyone have any knowledge about this?
Upvotes: 2
Views: 1003
Reputation: 460068
Try this:
If you use ODP.Net to access an Oracle database from .Net, and select LONG text columns, the DataReader’s GetString() method will return an empty string.
To work around this behavior, you need to set the
InitialLONGFetchSize
to a non-zero value, and use theOracleDataReader‘s
GetOracleString()
method, and useToString()
to convert the result into a .Net
string.Another possibility is to set
InitialLONGFetchSize
to -1, so thatGetString()
works as expected.
Found here: http://devio.wordpress.com/2009/08/24/reading-long-oracle-columns-in-net/
Upvotes: 2