473,387 Members | 3,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Locking DB for a short time

Joe
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.


Jul 19 '05 #1
1 1045
http://www.aspfaq.com/5003

Ray at work

"Joe" <in******@sympatico.ca> wrote in message
news:00*********************@news20.bellglobal.com ...
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Michael Chermside | last post by:
Ype writes: > For the namespaces in Jython this 'Python internal thread safety' > is handled by the Java class: > > http://www.jython.org/docs/javadoc/org/python/core/PyStringMap.html > > which...
12
by: Alban Hertroys | last post by:
Good day, I have a number of threads doing inserts in a table, after which I want to do a select. This means that it will occur that the row that I want to select is locked (by the DB). In these...
12
by: Puvendran | last post by:
Hi, We have encountered deadlock on a table which is used to generate sequential numbers for different categories eg typical entries Category Value TRADE_NO ...
16
by: Nid | last post by:
How do I do row-level locking on SQL Server? Thanks, Nid
1
by: jv | last post by:
Hello, I'm using A2K and am trying to make sure that my program only locks one record at a time and I don't seem to have any luck getting that to happen. In the database options, I've selected...
1
by: szabelin | last post by:
Do all asp threads servicing requests run as part of same app domain? I need a lock at the scope of my web-app; is the code below a correct way to syncronize blocks of code in asp.net. Will this...
15
by: z. f. | last post by:
Hi, i have an ASP.NET project that is using a (Class Library Project) VB.NET DLL. for some reason after running some pages on the web server, and trying to compile the Class Library DLL, it...
4
by: darrel | last post by:
I've been dealing with a file locking issue for a while. Our CMS spits out a new XML file each time an item in the DB is updated. This XML file is basically our site menu, and is what we use on...
7
by: Shak | last post by:
Hi all, I'm trying to write a thread-safe async method to send a message of the form (type)(contents). My model is as follows: private void SendMessage(int type, string message) { //lets...
5
by: Chris Mullins | last post by:
I've spent some time recently looking into optimizing some memory usage in our products. Much of this was doing through the use of string Interning. I spent the time and checked numbers in both x86...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.