• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

nanoseconds not returned from Oracle

I have a Timestamp(6) column in Oracle called EVENT_DATE, it is the primary key of the table.  
Example data copied directly from TOAD = 4/17/2006 12:13:06.478911 PM

I'm trying to return this value to a dataset, then a datagrid, and then pass this value to another page
as the key to display detailed data for the selected row.  However the nanoseconds are not being returned to the dataset, thus the key is incomplete when I go to search for the detail row.  
Sample SQL: "SELECT * from jobtrk.EVENTS where EVENT_TYPE = 'ERROR' and EVENT_DATE >= to_date('4/17/2006','MM/DD/YYYY');"

This SQL returns four rows to the dataset then on the datagrid, which is what I expect.  Executed in TOAD
it brings back four rows and the EVENT_DATE column is displayed including nanoseconds.  But when I view
the column in the dataset it looks like:
?ds.Tables(0).Rows(0).Item(0)  
#4/17/2006 12:13:06 PM# {Date}
    Date: #4/17/2006 12:13:06 PM#

Am I missing something from the SQL?  
Do I need to redefine something in the dataset to utilize the full timestamp?  
0
bozworthy
Asked:
bozworthy
  • 3
  • 2
1 Solution
 
Bob LearnedCommented:
ds.Tables(0).Rows(0).Item(0).ToString("dd MMM yy HH:mm:ss:fffffff")

Bob


0
 
bozworthyAuthor Commented:

?ds.Tables(0).Rows(0).Item(0).ToString
returns ==> "4/17/2006 12:13:06 PM"

?ds.Tables(0).Rows(0).Item(0).ToString("dd MMM yy HH:mm:ss:fffffff")
returns ==>  Conversion from string "dd MMM yy HH:mm:ss:fffffff" to type 'Integer' is not valid

I also tried several variations of that format string and get the same error with some invalid
cast exceptions depending on what I try.
0
 
Bob LearnedCommented:
?CType(ds.Tables(0).Rows(0).Item(0), DateTime).ToString("dd MMM yy HH:mm:ss:fffffff")

Bob
0
 
bozworthyAuthor Commented:
That is excellent.  

(For the record my Oracle field is storing six decimal places after the seconds. The solution posed above has an extra "f", which is adding a zero to the end of the timestamp and would cause the subsequent lookup to fail)  

Thanks much.
0
 
bozworthyAuthor Commented:
Actually now I need to post another question about how to get this value into the datagrid during the DataBind...
0

Featured Post

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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now