0

I am stuck at one point.

I am able to read data from csv file and display it on data gird view. Now, I want to insert those data (which is display in datagridview) into database.Also, at time of insert data with same primary key should get update.

I tried different way like stored procedure, loop but its not working.

I couldn't able to understand how should I read data line by line from datagridview and insert into database.

Rushabh Shah
  • 39
  • 2
  • 7

1 Answers1

1

Step #1, parse CSV into DataTable.

Step #2, set DataGridView.DataSource to the DataTable or a BindingSource attached to the DataTable.

Step #3, use a TableAdapter to write DataTable into database.

Community
  • 1
  • 1
Tergiver
  • 14,171
  • 3
  • 41
  • 68