Datagrid doesn't import all my .csv data !!
-
I have an datagrid who is filled automaticly by an .csv file
Private Sub frmCsv_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim file As String = "steelandt.csv" Dim pad As String = "C:\" Dim dataset As New DataSet Try Dim bestand As System.IO.File If bestand.Exists(pad & file) Then Dim ConStr As String = _ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ pad & ";Extended Properties=""Text;HDR=Yes;FMT=Delimited\""" Dim conn As New OleDb.OleDbConnection(ConStr) Dim databaseAdapter As New OleDb.OleDbDataAdapter("Select [PO],[Item],[Due Date],[Item Description] from " & _ file + " WHERE PO>0 order by PO ASC", conn) databaseAdapter.Fill(dataset) End If Catch ex As Exception MessageBox.Show(ex.ToString) End Try DataGrid.DataSource = dataset.Tables(0)
Now as you can see I import just 4 columns (PO, Item,Due Date and Item description) When I run the program everything works except : It doesn't load the item and due date colum.... and to make it worse, it imports just a few values of the column item How come ??