Avatar of monica73174
monica73174
 asked on

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

Avatar of undefined
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.

BEGIN TRAN MyTransaction

Select blah
from blahTable

COMMIT TRAN MyTransaction
ASKER CERTIFIED SOLUTION
Sham Haque

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JonWoyame

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.

Good luck!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck