Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Displaying Oracle DateTime field in .NET GridView

Posted on 2008-10-28
6
Medium Priority
?
646 Views
Last Modified: 2013-12-19
Experts,

I need your assistance in converting a Datetime field returned from an Oracle database into a .NET DateTime field which is displayed in a Grid View which shows only the Date part and not the Time
(For Eg: the Value in GridView is  6/11/1986 12:00:00 AM       and I want it as just c/11/1986)

I cannot create that column as a bound field as my DataSet returns variable columns everytime. So, there might or might not be a DateField in the DataSet too depending on the Query I run against the Database.

An early response would be really appreciated and helpful.

Thanx.
0
Comment
Question by:sydneyram
[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
6 Comments
 
LVL 12

Accepted Solution

by:
Pra4444 earned 2000 total points
ID: 22826651
Can you not retrieve the value from the Oracle as a character string using

select to_char(date,'MM\DD\YYYY') from your_query

0
 
LVL 14

Expert Comment

by:CtrlAltDl
ID: 22826697
Try just selecting the Date like this:
SELECT TO_CHAR(YourDateFieldName, 'DD/MM/YY') FROM myTable
0
 
LVL 14

Expert Comment

by:CtrlAltDl
ID: 22826702
Doh, I guess Pra4444 beat me to it.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Closing Comment

by:sydneyram
ID: 31510954
Awesome!!! thanks a lot for the quick response.
0
 
LVL 6

Expert Comment

by:M3mph15
ID: 22827813
Hi,
You can set the DataFormatString to something like {0:dd/MM/yyyy}.

Hope this helps
-M3mph15
0
 

Author Comment

by:sydneyram
ID: 22858484
M3mph15,

In my case it is an autogenerated column and not databound so I cannot you the dataformatstring property.


Pra4444,
Is there any other way of doing the same on the .NET side? I have to make a lot of logical changes in my code if i incorporate the TO_CHAR method of doing it.

Thanks.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

722 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