Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    11

    Unanswered: checking for unique constraints during a batch update

    hello .
    i have a grid for a table that gets updated with recordset.updatebatch
    for a multi-user application.

    the problem is that some of the table fields have to be unique

    now imagine the next situation.

    user A opens the form
    user B opens the form
    user A writes '1000' in the unique field
    user A saves the recordset with updatebatch

    user B writes '1000' in the unique field
    user B saves the recordset with updatebatch

    now there will be two records with the field '1000' !

    how can i avoid this ?
    i cannot check for unique during the update event of the grid
    because it should check during the time it is saving and not
    when it is just entering data without having updated the recordset

    thanks !

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621
    It is not a good idea to ask users input data for unique field in multi-user application. Use identity, triggers, etc.

  3. #3
    Join Date
    Jan 2004
    Posts
    184

    Re: checking for unique constraints during a batch update

    There is another solution, I just wanted to share with you a control featured on download.com that I have been using that has made my life easier, and it solves exactly the problem you are describing. When your user presses the update button on this control it automatically checks for conflicts and lets the user decide what to do. You can try it for free here:

    http://download.com.com/3000-2404-10...ml?tag=lst-0-1

    Basically, after selecting the CursorType, CursorLocation, LockType and Disconnected status of your Recordset (there are defaults). I bind my controls and that is it All the complexities of ADO are hidden from the user which is you.

    Then I can Navigate, Add New, Delete, Refresh, Search and Save Changes to my recordsets without any other code. That is really it, no other code is needed.

    This works in any environment VB, Access, VC++ etc...

    Let me know what you think, and if it works out for you.

    Originally posted by alexandros
    hello .
    i have a grid for a table that gets updated with recordset.updatebatch
    for a multi-user application.

    the problem is that some of the table fields have to be unique

    now imagine the next situation.

    user A opens the form
    user B opens the form
    user A writes '1000' in the unique field
    user A saves the recordset with updatebatch

    user B writes '1000' in the unique field
    user B saves the recordset with updatebatch

    now there will be two records with the field '1000' !

    how can i avoid this ?
    i cannot check for unique during the update event of the grid
    because it should check during the time it is saving and not
    when it is just entering data without having updated the recordset

    thanks !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •