Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 21st, 2003, 02:03 PM
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using a datagrid with Access D/B Time fields

I am using an Access Database and populating a Datagrid. I have 2 time fields in the database. They use the date/time format in the database. When displayed in the grid, they show up with 12/30/1899 preceeding the time. Then I changed the database to use short times. The same thing occurred. Is there a problem with a datagrid where it always shows this date in the time field? Here is the code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not IsPostBack Then
            OleDbConnection1.Open()
            Dim reader As System.Data.OleDb.OleDbDataReader
            reader = OleDbCommand1.ExecuteReader
            DataGrid1.DataSource = reader
            DataGrid1.DataBind()
            reader.Close()
            OleDbConnection1.Close()



        End If


    End Sub

Thanks for any help with this.
 
Old June 22nd, 2003, 04:14 AM
Authorized User
 
Join Date: Jun 2003
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I dont think its a problem.

I think that the default date is probably stored the same way in the database as it previously was, its just the format that the field is displayed that has changed.

I could be wrong about that, but it will be quite easy to format the column on the datagrid to display the date in a certain format regardless of how the date is stored, as long as its a valid date.

hth





Similar Threads
Thread Thread Starter Forum Replies Last Post
SELECTING CERTAIN FIELDS IN A DATAGRID??? twyce General .NET 1 November 14th, 2008 02:22 PM
subtracting two time mysql fields in php fochu PHP Databases 0 September 13th, 2006 08:17 AM
Adding Time Fields Brendan Bartley Access 3 July 30th, 2006 08:35 PM
comparing date/time fields on form validation Lucy Javascript How-To 1 June 20th, 2006 09:22 AM
setting date/time fields back to null value badgolfer Access 1 August 8th, 2005 02:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.