|
-
Apr 26th, 2013, 01:37 AM
#6
Re: Is this database update/insert code correct..it runs really slow for me
If you already have a DataTable then you should use it. You can simply loop through the data and call LoadDataRow on your DataTable for each record. That will take care of updating an existing row or adding a new one, so you don't have to check manually for duplicates. That will require that you set the PrimaryKey of your DataTable to the column(s) that you're using for comparison, which may or may not be the same as your actual PK. You can also fiddle with the UpdateBatchSize of your data adapter to see if you can speed up the actual save step.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|