Results 1 to 5 of 5

Thread: [02/03] DataGrid Problem 12/30/1899

Threaded View

  1. #1

    Thread Starter
    Lively Member Brian Henry's Avatar
    Join Date
    Oct 2005
    Posts
    94

    [02/03] DataGrid Problem 12/30/1899

    Hi all

    I'm getting a date value back in the column that holds my timestamp, The value = 12/30/1899.

    I'm loading data from a coma Delimited text file
    FileData= 04/12/2007,15:00:00,MTempQ,61.765,degf,G

    Heres the code.
    Code:
    Dim strConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" _
                        & "Data Source=" & strFilePath & ";" _
                        & "Extended Properties=""text;HDR=NO;FMT=Delimited"""
    
                Dim conn As New OleDb.OleDbConnection(strConnectionString)
                conn.Open() ' Open connection with the database.
    
                Dim objCmdSelect As New OleDb.OleDbCommand("SELECT * FROM [" & strFileName & "]", conn) ' Create new OleDbCommand to return data.
                'Dim objCmdSelect As New OleDb.OleDbCommand("Select * from [Sheet1$]", conn) ' Create new OleDbCommand to return data from worksheet.
    
                ' Create new OleDbDataAdapter that is used to build a DataSet based on the preceding SQL SELECT statement.
                Dim objAdapter1 As New OleDb.OleDbDataAdapter
                objAdapter1.SelectCommand = objCmdSelect 'Pass the Select command to the adapter.
                Dim objDataset1 As New DataSet 'Create new DataSet.
                objAdapter1.Fill(objDataset1) 'Fill the DataSet with the information from the file.
    
                formatview.DataGrid1.DataSource = objDataset1.Tables(0).DefaultView 'Build a table from the original data.
    
                conn.Close() 'Clean up objects.
    I'm Using vb.net 2003
    Last edited by Brian Henry; May 22nd, 2007 at 08:21 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width