Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Oracle VB.NET
Respected sir/mam

I want to store a date and time in oracle 10g database.
I am trying to inserting a date and time and my statement is
dsNewRow.Item("date_time") = Format(DateTime.Today, ("yyyy-MM-dd HH:mm:ss.000"))
in the above statement only date is inserting in database. But i want to inserting date as well as time. My date_time fields data type is date.
how it is possible?

Please help me.

Thank You in advance.
Posted 12-Feb-12 21:22pm
Edited 12-Feb-12 21:34pm
Mehdi Gholam269.7K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I remember, that Oracle "can" handle DateType field values as string. If you write a query the date has to be given as string in the where-clause:

Select * From Employee Where HireDate >= '01-01-2011 00:00:00'

So, it is correct that you put a string value.

Furthermore, you can use the OracleDateTime structure from the Oracle-Namespace when you use the drivers from Oracle and not from Microsoft.

Using the Oracle drivers from Microsoft is not recommended.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sascha Lefévre 490
1 Sergey Alexandrovich Kryukov 353
2 Maciej Los 210
3 Abhinav S 205
4 Richard Deeming 180
0 Sergey Alexandrovich Kryukov 6,928
1 OriginalGriff 6,381
2 Maciej Los 2,782
3 Abhinav S 2,732
4 Peter Leow 2,694

Advertise | Privacy | Mobile
Web02 | 2.8.150414.1 | Last Updated 13 Feb 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100