I am trying to import a tab delimited text file into a DataTable, but it does not appear to be splitting the columns properly. The code below does not error out but it also does not split up the data into the proper columns.
Column Names Output
First Last Address 1 Address 2 City State Zip
F2
F3
F4
F5
F6
F7
As you can see in the above output, it is putting all the column names into the first column. I have highlighted the portion of my code I believe to be the issue. I have tried several different iterations of this, but everything has the same result.
I've tried the following:
Code:
FMT=Delimited(" & vbtab & ")';
Code:
FMT=Delimited(Tab)';
Here is my code so far:
Code:
Dim PathToUse As String = "C:\WORK\A_TEST\"
Dim MyConnection As OleDbConnection
Dim MyCommand As OleDbDataAdapter
MyConnection = New OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & PathToUse & "';Extended Properties='Text;HDR=Yes;FMT=Delimited(Tab)';")
MyCommand = New OleDbDataAdapter _
("select * from [tab.txt]", MyConnection)
MyCommand.Fill(AddressListDatatable)
Dim Counter As Integer = 0
For Each row In AddressListDatatable.Rows
MsgBox(AddressListDatatable.Rows(Counter)(0).ToString)
Counter = Counter + 1
Next