Hello,
I am wondering if anybody can have a look to my issue and help me with the code.
here is the situation:
I have a simple but old access '97 DB (mdb) who is feed by an third party program.
I want to collect some data out of it present it in a datagrid and export this into a excel file.
This all works fine, except for one thing:
One of the column (0) has dates in it (ex.25/11/2015) but the mdb is missconfigured and gives a 5digit (numbers) in stead of.
now may question is how can change the gridview so that it adapts the colomn and transforms the 5digits into a real date.
Here is my code:
Here are 2 screenshot out of excel to make it more clear:Code:Imports System.Data.OleDb Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load End Sub Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Progwsrb\Data\WSRB.mdb" Dim MyConn As OleDbConnection Dim da As OleDbDataAdapter Dim ds As DataSet Dim tables As DataTableCollection Dim source1 As New BindingSource Private Sub btn_filter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_filter.Click MyConn = New OleDbConnection MyConn.ConnectionString = connString ds = New DataSet tables = ds.Tables da = New OleDbDataAdapter("Select AfvalDatum, AfvalUur, AfvalWeegnr, AfvalNummerplaat, AfvalProduct, AfvalAantalkg, AfvalGemeente, AfvalKlantCode from [TblAfval] WHERE AfvalKlantCode = 'RABACO' ORDER BY AfvalKlantCode", MyConn) 'Change items to your database name da.Fill(ds, "TblAfval") 'Change items to your database name Dim view As New DataView(tables(0)) source1.DataSource = view DataGridView1.DataSource = view DataGridView1.Columns(0).ValueType = GetType(Date) End Sub
Here is a screenshot of the actual gridview
Many thanks for all your help
Kindly regards,
Koen




Reply With Quote
