?
Solved

How to convert OracleDbType.Date to .net DateTime

Posted on 2007-04-05
4
Medium Priority
?
5,348 Views
Last Modified: 2008-03-04
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?
0
Comment
Question by:karanba
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 22

Assisted Solution

by:Mohammed Nasman
Mohammed Nasman earned 200 total points
ID: 18856528
DateTime d = Convert.ToDateTime(cmd.Parameters["dateP"].Value);
0
 
LVL 3

Assisted Solution

by:ieciep
ieciep earned 400 total points
ID: 18856595
mnasman is right
DateTime d = Convert.ToDateTime(cmd.Parameters["dateP"].Value);
0
 

Author Comment

by:karanba
ID: 18856618
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'.
0
 
LVL 8

Accepted Solution

by:
Rytmis earned 400 total points
ID: 18856762
DateTime d = (DateTime) cmd.Parameters["dateP"].Value;

(According to the ODP.NET docs, OracleDate defines an explicit conversion to a DateTime)
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question