You must Sign In to post a response.
  • Category: .NET

    Data insert issue if multipe user insert data through same application using single database

    i have developed application called Marketing, if we insert data through that application from multiple computers at same time then duplicate data creates.
    when user open the enquiry screen i am displaying Enquiry Number at text box and other controls allowed to enter by user.
    in enquiry form i have Enquiry Number(included prefix "Enquiry") like :"Enquiry-001" and after save Enquiry Number will be "Enquiry-002" to enter next enquiry

    issue is if multiple user opens the same screen by different computers at the same time then it will displays "Enquiry-002" if those user saves the enquiry it will be saved as Enquiry-002 for all user so it will like duplicate enquiry in database(for all user Enquiry Number saving as Enquiry-002)

    what is the solution for this issue.
  • #767517
    Hi don't display the enquiry number for users. Just make that auto increment so that who ever they may open the form , first saved record will get number as example 100, next saved record will take 101 and next saved will be 102... so on.
    Hope it helps.

    Sridhar Thota.
    Editor: DNS Forum.

  • #767518
    @sridhar thota : Hi , i am maintaining id as primery key for interval work and for user i need to show enquiry number and this column is separate and its start from 001 include prefix like ENQUIRY-001 and i have created master screen to add and they can active prefixes so that activated prefixes will be displayed with number like ENQUIRY-001

  • #767519
    Hi

    Set Primary key in your Autonumber then you can restrict after 2 post. when the user enter the records to save after you can get and shows the current record +1 otherwise. auto refresh in every 5 min in your ENQUIRY no generation part.

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #767520
    its required to show which enquiry user going to enter (Enquiry Number) Enquiry No at screen.
    when user open the enquiry screen i am displaying Enquiry Number at text box and this no saving at Enquiry column in database.
    database in table if saving enquiries from single computer
    id(primerykay) EnquiryNo Description Qty
    1 Enquiry-001 mouse 1
    2 Enquiry-002 keyboard 1
    3 Enquiry-003 Speaker 2
    if the application is using from multiple users by different computers
    id(primerykay) EnquiryNo Description Qty
    1 Enquiry-001 mouse 1
    2 Enquiry-001 keyboard 1
    3 Enquiry-001 Speaker 2
    problem is Enquiry No saves same if the application is using from multiple users by different computers

  • #767527
    Hi,

    As per my understand the post you want to show the EnquiryNumber but this is not a part in PrimaryKey column, you have created separate Id for PK right?

    Assume Table structure

    Enquiryid int PK
    enquiryNum VARCHAR(100)


    your question is same time 2 users open the application and Generate New EnquiryNumber for both the users, but while saving time you have conflict with that number that is your problem now right?

    My suggestion is before saving the record into database please check the Enquiry number is exist or not. If it is exist then raise a alert stating that same number is already present, are you sure to revise the Enquiry Number ? If you click Yes then Change the Enquiry Number and then save it again.

    Hope this helps you...

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #767540
    when you want to create an auto generated number after insertion then you need to create an auto generated column in database, it will automatically handle the request by multiple user, you can use @@IDENTITY to fetch the auto incremented id
    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


Sign In to post your comments