将csv文件导入datagridview时出现问题。它只在添加列中不在适当的列中。
以下是代码:
Try
Dim conn As System.Data.OleDb.OleDbConnection
Dim ds As System.Data.DataSet
Dim comm As System.Data.OleDb.OleDbDataAdapter
Dim path As String = filepath
conn = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + "; Extended Properties=Excel 12.0;")
comm = New System.Data.OleDb.OleDbDataAdapter("Select * from [WSC2017_TP09_M2_Schedules_V12_a$]", conn)
ds = New System.Data.DataSet
comm.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
conn.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
这里有一些图片......
应该在这里: 但它在这里: