How to keep data seperate in an application when there maybe more than one person at a time
I have an application that loads a spreadsheet then populates a database with the data.
The next step is running an SSIS package.
The problem I am worried about is if two users want to use the application at the same time. Each set of data needs to be treated seperately. So if I load one spread sheet and need to run the ssid and someone else loads a spreadsheet and needs to run the ssid on their own data it will not get mixed together. I hope this makes sense. Any ideas??
.NET ProgrammingMicrosoft SQL Server 2005
Last Comment
JonWoyame
8/22/2022 - Mon
geodan7
In the SQL procedure, use a transaction so that it locks things up, so that multiple users won't affect each other.
I've just done something similar with uploading Excel spreadsheets to a DB, and this is how I handled it:
* I created a DB table called SheetData that had the records that were uploaded
* I created a DB table called UploadJobs that had a record for each spreadsheet uploaded to the DB
* The SheetData table had a field called Job that was a foreign key to the UploadJob table
When a spreadsheet was going to be uploaded, I created a new UploadJob entry and extracted its auto-numbered ID. This ID was written to each record that was put in SheetData. When two users upload simultaneously, you can identify what data belongs to each upload by the Job field of the records.
Of course, this was all done in a transaction so that if any errors occurred during the upload I could rollback the inserts.
BEGIN TRAN MyTransaction
Select blah
from blahTable
COMMIT TRAN MyTransaction