Click here to Skip to main content
15,897,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everybody

at first let me to excuse for my bad english.

i try to convey my problem clearly.

my application suppose to connect to a MS Access database.

First layer: consist of property related to my table fields

Second layer: a function return requested rows as DataTable of same table

Third layer: after getting DataTable from second layer, return that as DataTable of same table.

Finally in Presentation layer I put DataTable in a BindingSource and assign it to DataGridView.DataSource.

Ok, I can see the requested rows correctly so far but, how can I save all changes which has made by user in DataGridView?

***************************

1: Is it correct to create a loop to Update each row separetly?

2: Or I must send all changes as DataTable to database?

Main problem:

for the first solution I know that how should I do it but for second I can't find any way to do it because I don't know how I can send DataTable to database through 3 layer.

if my question is vague, please tell me
Posted
Updated 6-Sep-15 3:37am
v2

1 solution

Selecting a approach depends on your requirement.

To update multiple rows at once you may use SqlBulkCopy[^]. check this detailed article with demo source code.
SqlBulkCopy- Bulk Insert records and Update existing rows if record exists using C# and VB.Net[^]

In case you have implementing this or if your requirement is other than this, please let me know.

Hope, it helps :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900