Hi,
First convert your csv file to DataTable, For your reference find the below codes.
Private Function CSVtoDataTable(ByVal filepath As String) As DataTable
Dim sr As New StreamReader(filepath)
Dim f As File
Dim fval As String()
Dim dt As New DataTable
Dim dr As DataRow
sr = f.OpenText(filepath)
fval = sr.ReadLine().Split(",")
For i As Integer = 0 To fval.Length - 1
dt.Columns.Add(New DataColumn(fval(i).ToString()))
Next
dr = dt.NewRow
While sr.Peek() <> -1
fval = sr.ReadLine().Split(",")
dr = dt.NewRow
For i As Integer = 0 To fval.Length - 1
dr.Item(i) = fval(i).ToString()
Next
dt.Rows.Add(dr)
End While
Return dt
End Function
Then insert the datatable's records to the sql table using SqlBulkCopy method. Refer my tips from the following url
SQL Bulk copy method to insert large amount of data to the sql database[
^]
Hope this will help you,
Regards,
Bluesathish