bobbyforhire
Technical User
Currently I am using a string to manually attach a csv to a datgrid. But now I would like to use a .XLS file but can't think of the connection string. Any ideas on how to change this code so it cna use XLS files?
Dim DataFile As FileInfo = New FileInfo("C:\ALL_CARDS.csv")
Dim cnCSV As OdbcConnection
Dim daCSV As OdbcDataAdapter
Dim dt As DataTable = New DataTable("ALL")
cnCSV = New OdbcConnection("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & DataFile.Directory.FullName & ";")
daCSV = New OdbcDataAdapter("SELECT * FROM [" & DataFile.Name & "]", cnCSV)
daCSV.Fill(dt)
UltraGrid1.DataSource = dt
Me.UltraGrid1.DisplayLayout.Bands(0).Columns(0).CellActivation = Activation.Disabled
Dim DataFile As FileInfo = New FileInfo("C:\ALL_CARDS.csv")
Dim cnCSV As OdbcConnection
Dim daCSV As OdbcDataAdapter
Dim dt As DataTable = New DataTable("ALL")
cnCSV = New OdbcConnection("Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & DataFile.Directory.FullName & ";")
daCSV = New OdbcDataAdapter("SELECT * FROM [" & DataFile.Name & "]", cnCSV)
daCSV.Fill(dt)
UltraGrid1.DataSource = dt
Me.UltraGrid1.DisplayLayout.Bands(0).Columns(0).CellActivation = Activation.Disabled