Link to home
Start Free TrialLog in
Avatar of karanba
karanba

asked on

How to convert OracleDbType.Date to .net DateTime

Hi,
I want to convert OracleDbType.Date to .net DateTime.

OracleParameter param1 = new OracleParameter("dateP", OracleDbType.Date);
param1.Direction = System.Data.ParameterDirection.Output;
cmd.Parameters.Add(param1);
cmd.ExecuteNonQuery();

---> ?  DateTime d = cmd.Parameters["dateP"].Value

And a second question does the given parameter name in OracleParameter  must be the same with defined in procedure?
SOLUTION
Avatar of Mohammed Nasman
Mohammed Nasman
Flag of Palestine, State of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of karanba
karanba

ASKER

DateTime d = Convert.ToDateTime(cmd.Parameters["dateP"].Value);

that gives the following error.

Unable to cast object of type 'Oracle.DataAccess.Types.OracleDate' to type 'System.IConvertible'.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial