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

    Unanswered: Should i use Bound or unbound controls ?

    Hello !
    i am new to databases so i would be grateful for your help.
    I am using SQL Server 2000 and vb to access and update the records of a database.

    I want your opinion about the way i am displaying data.
    I have created a form with textboxes etc. which display the fields
    of the table.
    Now when i load the form i populate a recordset with a
    "select ... from... " query.

    Then i manually
    set

    txtfield1.text=cstr(recordset.fields("field1").val ue)

    etc...

    If i want to update the table then i have to construct manually the
    query.

    "update ... set field1='"+ txtfield.text +"' "

    if i want to move to a next record i do

    recordset.movenext
    and then
    txtfield1.text=cstr(recordset.fields("field1").val ue)

    again
    Is that good or should i use bound controls ?

    If multiple users access the same form at the same time (from different computers) will they be locked only when they save (update) data ?

    Thank you !

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    It'll be cleaner if you implement your own locking to prevent users from attempting to update the data that is being updated by someone else. Relying on SQL to timeout connections that attempt to update the data being modified by another user will only frustrate your customers. With your custom locking, that can be implemented with only one table, the user can just get a message box saying that the data is being modified by another user.

    In short, - don't use bound controls unless they are used for display only, like grids or reports.

  3. #3
    Join Date
    Jan 2004
    Posts
    11
    That sounds very interesting. Do you know where i can find more information about custom locking ?
    I use True DB Grid to update also data . Is it necessary to lock the table
    each time the user opens a form that uses such a grid ?

    Moreover , how is custom locking being implemented ?
    Everytime the user opens a form that accesses a specific table
    do i have to write in a record that this table is being accesses and then
    the other users that will try to open this form will be informed that this
    form/table is already being used ?

    Thank you very much for your time and effort to reply to me

    Alexander

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    I agree with rdjabarov - don't use bound controls.

    What kind of locking do you want to implement (pessimistic,optimistic...) ? Think about the various scenarios.

  5. #5
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Usually I either do a locking by table, or, more often, by business logic. For example, I have many tab-based forms where multiple info gets displayed. Many elements on those tabs are coming from different tables. When one user clicks on Edit button, a table acquires a record with info reflecting the user's workstation, date/time, user name, and logical unit being modified. Other users when attempting to do the same receive a message that this part of information is being modified by...the elements listed above go into the message. It get a little more complex when modification of one set of info invalidates the other even though the other info is not affected. In this situation you need to think through from the business perspective what comprises a logical unit. Also, in earlier stages of development you may find yourself leaving records in that LOCK table even though users are long gone (whatever reason may be behind, - connection broken, you forgot, etc.) For that I also wrote a scheduled task that does a cleanup of entries that should not be in the table.

Posting Permissions

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