需要将包含300万条记录的csv文件读取到DataSet中。使用OleDBAdapter读取CSV文件并将整个内容移到DataSet中。
Dim FolderPath As String = Path.GetDirectoryName(FileDetails)
Dim tblCSV As New DataSet
Dim OleDBConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
FolderPath & _
";Extended Properties=""text;HDR=Yes;FMT=Delimited"";"
Dim OleDBConn As OleDbConnection
OleDBConn = New OleDbConnection(Trim(OleDBConnString))
OleDBConn.Open()
Dim OleDBAdapater As New OleDbDataAdapter("SELECT * FROM [" & Import_File_Name & "]", OleDBConn)
OleDBAdapater.Fill(tblCSV)
MessageBox.Show(tblCSV.Tables.Item(0).Rows.Count)