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
Solved

Displaying Oracle DateTime field in .NET GridView

Posted on 2008-10-28
6
638 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
6 Comments
 
LVL 12

Accepted Solution

by:
Pra4444 earned 500 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
edit .asp files 5 31
Using data from certificate to re-create certificate programmatically 3 26
Help with Oracle IF statment 5 26
How to repeat the data 4 18
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

839 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