Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Oracle Error: Unable to cast object of type Oracle.DataAccess.Types.OracleDate to type System.IConvertible

$
0
0

I'm getting the following error when I try to convert an OracleParameter Date field to a .net Datetime field.
{"Unable to cast object of type 'Oracle.DataAccess.Types.OracleDate' to type 'System.IConvertible'."} System.InvalidCastException.
I've included snipets of the code.  The stored procedure it calls is working OK. I can bind it to a gridview without a problem.  What I can't do it take the return value and convert it into a .net DateTime field. I tried to convert it to a string but that only returns the date portion of the field - I need the time as well. Ultimately, I want the field to be tied to a calendar control.  All help appreciated. Thanks.

OracleParameter oraParmGet_START_DATE_OUT =newOracleParameter();
...
oraParmGet_START_DATE_OUT.ParameterName = "START_DATE_OUT";
oraParmGet_START_DATE_OUT.OracleDbType =
OracleDbType.Date;
oraParmGet_START_DATE_OUT.Direction =
ParameterDirection.Output;
oraParmGet_START_DATE_OUT.Size = 38;
...
DateTime startDate = Convert.ToDateTime(oraParmGet_START_DATE_OUT.Value);

 


 


Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>