18-02-22 12:51 PM
Answered! Go to Answer.
18-02-22 02:06 PM
Dim SR As StreamReader = New StreamReader("yourpath\csvfilename.CSV")
Dim line As String = SR.ReadLine()
Dim strArray As String() = line.Split(","c)
Dim dt As DataTable = New DataTable()
Dim row As DataRow
Dim iCounter As Long = 0
For Each s As String In strArray
dt.Columns.Add(New DataColumn(strArray(iCounter).ToString()))
iCounter = iCounter + 1
Next
Do
line = SR.ReadLine
If Not line = String.Empty Then
row = dt.NewRow()
row.ItemArray = line.Split(","c)
dt.Rows.Add(row)
Else
Exit Do
End If
Loop
Dim rcnt As Long
rcnt = dt.Rows.Count
18-02-22 02:06 PM
Dim SR As StreamReader = New StreamReader("yourpath\csvfilename.CSV")
Dim line As String = SR.ReadLine()
Dim strArray As String() = line.Split(","c)
Dim dt As DataTable = New DataTable()
Dim row As DataRow
Dim iCounter As Long = 0
For Each s As String In strArray
dt.Columns.Add(New DataColumn(strArray(iCounter).ToString()))
iCounter = iCounter + 1
Next
Do
line = SR.ReadLine
If Not line = String.Empty Then
row = dt.NewRow()
row.ItemArray = line.Split(","c)
dt.Rows.Add(row)
Else
Exit Do
End If
Loop
Dim rcnt As Long
rcnt = dt.Rows.Count