I have a .csv file that is selected using the OpenFileDialog that then populates a DataGridView. The .csv file is then visible for the user to check a number of things. This part works fine.

What I then need is once it is checked the user then needs to click a button to import this into my SQL Server table (CSV_Import). I have looked at SQLBulkCopy but am failing to get the data imported.

Here is some code I have picked up and I am guessing that it is the bc.WriteToServer(dt) needs correcting within the brackets but I am at a loss at this point.

bc.BatchSize = dt.Rows.Count
bc.DestinationTableName = "CSV_Import"
bc.WriteToServer(dt)

bc.Close()
myConnection.Close()

Please advise, thanks.