locked
Multi-users and sequences from SQL Server RRS feed

  • Question

  • 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 :)


    Saturday, November 14, 2020 2:35 PM

Answers

  • Hello,

    Your best option is to ask in the Q&A Microsoft forum or StackOverflow forums, sample tag based.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    My GitHub code samples
    GitHub page

    Saturday, November 14, 2020 7:50 PM

All replies

  • Hello,

    Your best option is to ask in the Q&A Microsoft forum or StackOverflow forums, sample tag based.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    My GitHub code samples
    GitHub page

    Saturday, November 14, 2020 7:50 PM
  • Thank you Karen, I went in the Q&A Microsoft forum and post my question there. I visit your GitHub page and it is very interesting and I will learn how it works.

    I wrote an application in Microsoft Access and after 10 years I went up to more than 300 small businesses that are using my cash register application.

    However, with all the experiences I gain in these 10 years, I have decided to rewrite my application in VB.Net and make it available in the US, a lot of work because I have to learn .net and also ASP.Net core in order to do that, but I am gettin there because of person like you that share their experiences.

    Thanks for taking the time to answer my question and direct me in a super place.

    Claude

    Sunday, November 15, 2020 11:35 AM
  • ASP.NET CORE does not work with VB.NET that i know about currently. ASP.NET  Core works  with MVC, Blazor and Razor with C#. There is no web forms in ASP.NET Core.  The closest t hing to web forms is Razor pages. 

    Also there is this.

    https://dzone.com/articles/reasons-move-datatables

    I also suggest that you learn Entity Framework or Dapper and abandon  table adapters, datasets and datatables if you want a high performance and scalable Web based  solution.

    ASP.NET can be discussed at the ASP.NET forums.

    https://forums.asp.net/

    Sunday, November 15, 2020 3:03 PM
  • In regards to ASP.NET Core, about ten years ago our VB.NET team moved from VB.NET, IBM databases to C#, SQL-Server and Entity Framework 6.

    I left that agency and now using C#, SQL-Server, Oracle via Entity Framework Core. Projects range from plain Jane ASP.NET Core to WPF in Visual Studio.

    Going back to the first team moving from VB.NET, the reasons we went C# is this is much easier to by a full stack developer when thinking about C# backend with JavaScript/JQuery front end, it's much easier to flip flop between frontend and backend plus we saw the writings on the wall, C# is a first class language in the ecosystem while VB.NET is a second class language in the ecosystem. 

    When I wrote VB.NET code samples the majority of the time I'm thinking about how can I get VB developers to consider C# rather than conform to VB.NET. Heck there have been times when I've presented a VB.NET code sample here and in other forums were the person asking the question says I want VB code sample and you gave me a C# code sample while in fact I gave them a VB.NET code sample.

    So with that you might consider learning C# as when coding for the web there are more resources and guaranteed the language will be around and even better that it advances.

    Last note, once you use Entity Framework Core and understand it you will never want to go back to old style coding using connections and command objects or any form of Adapter e.g. DataAdapter or TableAdapter. Sadly to use EF Core smoothly you need to use C# while VB.NET is not smooth to setup.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    My GitHub code samples
    GitHub page

    Sunday, November 15, 2020 4:08 PM