Professional Web Applications Themes

Locking DB for a short time. - ASP Database

I am sure this is an old issue for ASP veterans, but I come from a Cold Fusion background, in which what I will ask below can be easily done. Let's say I have two tables named "Companies" and "Users" respectively. In the Companies DB, the column with the unique ID and primary key is called "CompID", and is Auto Number. Many users can be linked to a single company. This link is determined by a column called also CompID in the Users table. Now, sometimes a user will specify a new company that's not in the table Companies, which ...

Sponsored Links
  1. #1

    Default Locking DB for a short time.

    I am sure this is an old issue for ASP veterans, but I come from a
    Cold Fusion background, in which what I will ask below can be easily
    done.

    Let's say I have two tables named "Companies" and "Users"
    respectively.

    In the Companies DB, the column with the unique ID and primary key is
    called "CompID",
    and is Auto Number.

    Many users can be linked to a single company. This link is determined
    by a column
    called also CompID in the Users table.

    Now, sometimes a user will specify a new company that's not in the
    table Companies,
    which means that I have to insert a new record in the Company table,
    creating thus a new CompID which I then have to read -Max(CompID)- and
    update the Users.CompID with this value.

    Between the insertion of the new record and the update other users of
    the database must be
    prevented from making changes. How does one do that? I've heard stuff
    about using
    Application.Lock, but doesn't that work only with Application
    variables? Or can one just go and use code like below:

    <%
    Application.Lock

    SQL stuff ...
    other SQL stuff ..

    Application.Unlock
    %>

    Please, help. Thanks in advance.








    Sponsored Links
    Joe Guest

  2. #2

    Default Re: Locking DB for a short time.

    Don't lock the DB or the application. Retreive the ID from that record the
    proper way instead. You didn't indicate what type of database you're using,
    but chances are whatever you're using is covered here.

    http://www.aspfaq.com/show.asp?id=2174


    Ray at work

    "Joe" <ca> wrote in message
    news:bRK%c.22769$bellglobal.com... 


    Ray Guest

  3. #3

    Default Re: Locking DB for a short time.

    Thanks, Ray

    Ed.


    Joe Guest

Similar Threads

  1. How can I avoid the mouse click during a short period of time???
    By LAGRO in forum Macromedia Director Lingo
    Replies: 1
    Last Post: October 6th, 08:39 PM
  2. Laptop locks after short time of inactivity
    By Brad in forum Windows Setup, Administration & Security
    Replies: 1
    Last Post: July 9th, 07:43 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139