Multi-users and sequences from SQL Server

  • Thread starter Thread starter Claude du Québec
  • Start date Start date
C

Claude du Québec

Guest
Hi everyone,

I look at Wide World Importers and the way Microsoft has setup the sequences to generate ID, I keep that principle and I have created a sequence for OrderID named it Sequences.OrderID has the WWI sample database is showing us, I plan to use that sequence in my table Sales.Orders.

My application will be use in a multi-users environment so in my ordering module, I am saving the data and using the sequence only when the user has finish to enter the products in the order. By doing so I think that the chances to have a gap in the OrderID is minimal unless a rollback is possible.

Here is my question, with all the sophisticated possibilities on SQL and Visual Studio, how can it be possible to not have a gap

in the orders table when an app is use by several users at the same time? Is is possible or not? and if it is, can you direct me

in the right direction.


Note: I already have created a new query in the OrdersTableAdapter:

SELECT NEXT VALUE FOR Sequences.OrderID
Save as: ScalarOrderIDQuery
Me.OrderIDTB.Text = Me.OrdersTableAdapter.ScalarOrderIDQuery()


I am using the last phrase in these 3 lines to obtain the next ID and it works for now, but I did not test in a multi-user environment.

Thanks

Being from Quebec, please forgive the mistakes I might do :)

Continue reading...
 

Similar threads

S
Replies
0
Views
57
sva0008
S
D
Replies
0
Views
931
Dante Havenaar
D
I
Replies
0
Views
77
IT Pro - Microsoft Windows Information
I
Back
Top