473,480 Members | 3,796 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

database access

dee
Hi
I just implemented a hit counter. I lookup the value from an access database
table and then increment and update the result to databse. What happens if
two users access this code at the same time? Is there locking in aspnet?
Thanks.
Dee
Nov 19 '05 #1
8 1461
"dee" <de*@home.net> wrote in news:OE*************@TK2MSFTNGP10.phx.gbl:
I just implemented a hit counter. I lookup the value from an access
database table and then increment and update the result to databse.
What happens if two users access this code at the same time? Is there
locking in aspnet?


That's upto you to implement... you could lock the row in the database.

Or why don't you just insert a record for each access - and do a SELECT
COUNT to find out the number of hits? While it'll take up more space in the
database, it's definately safer than incrementing a value.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
dee
Thanks Lucas
I hadn't thought of that its an interesting idea.
Would you have the same approach when database is accessed to change a
user's password, i.e., create a new row with the new password and delete the
old entry?
Dee
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"dee" <de*@home.net> wrote in news:OE*************@TK2MSFTNGP10.phx.gbl:
I just implemented a hit counter. I lookup the value from an access
database table and then increment and update the result to databse.
What happens if two users access this code at the same time? Is there
locking in aspnet?


That's upto you to implement... you could lock the row in the database.

Or why don't you just insert a record for each access - and do a SELECT
COUNT to find out the number of hits? While it'll take up more space in
the
database, it's definately safer than incrementing a value.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #3
dee
Thanks Lucas
Would INSERTs need to be synchronized too?

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"dee" <de*@home.net> wrote in news:OE*************@TK2MSFTNGP10.phx.gbl:
I just implemented a hit counter. I lookup the value from an access
database table and then increment and update the result to databse.
What happens if two users access this code at the same time? Is there
locking in aspnet?


That's upto you to implement... you could lock the row in the database.

Or why don't you just insert a record for each access - and do a SELECT
COUNT to find out the number of hits? While it'll take up more space in
the
database, it's definately safer than incrementing a value.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #4
"dee" <de*@home.net> wrote in news:Ow*************@TK2MSFTNGP11.phx.gbl:
Thanks Lucas
I hadn't thought of that its an interesting idea.
Would you have the same approach when database is accessed to change a
user's password, i.e., create a new row with the new password and
delete the old entry?


No, I would just update the user's password record. This is because when
you update a password record, you are updating a specific record for a
specific user. While it is possible that 2 different people may update the
same password record, this is a rare occurance.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #5
You should put this in a transaction. That way, as soon as one user has
updated the total the row in whatever table keeping that total will become
locked. The second user's thread will wait until the first user's
transaction has finished before it will proceed.

The other way, is to synchronize access to the block of code updating the
hit counter by using Monitor.Enter/Monitor.Exit. I think there is also a
Lock statement that lets you lock on an object.

"dee" <de*@home.net> wrote in message
news:OE*************@TK2MSFTNGP10.phx.gbl...
Hi
I just implemented a hit counter. I lookup the value from an access
database table and then increment and update the result to databse. What
happens if two users access this code at the same time? Is there locking
in aspnet?
Thanks.
Dee

Nov 19 '05 #6
dee
Thanks alot.
That's very helpful.

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@127.0.0.1...
"dee" <de*@home.net> wrote in news:Ow*************@TK2MSFTNGP11.phx.gbl:
Thanks Lucas
I hadn't thought of that its an interesting idea.
Would you have the same approach when database is accessed to change a
user's password, i.e., create a new row with the new password and
delete the old entry?


No, I would just update the user's password record. This is because when
you update a password record, you are updating a specific record for a
specific user. While it is possible that 2 different people may update the
same password record, this is a rare occurance.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 19 '05 #7
dee
Marina
Thanks for your suggestion.
Appreciative your help.
Dee
"Marina" <so*****@nospam.com> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
You should put this in a transaction. That way, as soon as one user has
updated the total the row in whatever table keeping that total will become
locked. The second user's thread will wait until the first user's
transaction has finished before it will proceed.

The other way, is to synchronize access to the block of code updating the
hit counter by using Monitor.Enter/Monitor.Exit. I think there is also a
Lock statement that lets you lock on an object.

"dee" <de*@home.net> wrote in message
news:OE*************@TK2MSFTNGP10.phx.gbl...
Hi
I just implemented a hit counter. I lookup the value from an access
database table and then increment and update the result to databse. What
happens if two users access this code at the same time? Is there locking
in aspnet?
Thanks.
Dee


Nov 19 '05 #8


this newsgroup is a joy to behold

that was one of the sweetest exchanges i have ever seen

get a room!

and why not read to each other from a book about database locking?

oh and make sure to buy a big hard disk to store all those hitcounter
records, they will make great reading:

1 hit
2 hit
3 hit
4 hit
5 hit
6 hit
....
12,234,154 hit
12,234,155 hit

ha ha ha ha ha

brilliant

you guys are the best

oh no! what happens if the hit counter is updated after the first
user comes but before the first user receives the html?
he will see a number out by one!!!! thats deception!!!!
maybe we can implement a distributed transaction coordinator
to make sure that the users eyes have processed the information
and their brain has fully understood it before updating the hit
counter and releasing a page to another user
oh no! what if google spiders the page???? should we include
that in the count??? maybe just half a hit? or should we make
a new table to keep track of googles hits??? maybe we should ring
google now and ask ... but we want to track whether the user
is male or female, lets ask them to fill in their telephone number
so we can ring and ask!! maybe we can just dial their ip address ...
i'm sure it will work





dee wrote:
Marina
Thanks for your suggestion.
Appreciative your help.
Dee
"Marina" <so*****@nospam.com> wrote in message
news:Ov**************@TK2MSFTNGP12.phx.gbl...
You should put this in a transaction. That way, as soon as one user has
updated the total the row in whatever table keeping that total will become
locked. The second user's thread will wait until the first user's
transaction has finished before it will proceed.

The other way, is to synchronize access to the block of code updating the
hit counter by using Monitor.Enter/Monitor.Exit. I think there is also a
Lock statement that lets you lock on an object.

"dee" <de*@home.net> wrote in message
news:OE*************@TK2MSFTNGP10.phx.gbl...
Hi
I just implemented a hit counter. I lookup the value from an access
database table and then increment and update the result to databse. What
happens if two users access this code at the same time? Is there locking
in aspnet?
Thanks.
Dee



Nov 19 '05 #9

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

Similar topics

6
3119
by: Sarah Tanembaum | last post by:
I was wondering if it is possible to create a secure database system using RDBMS(MySQL, Oracle, SQL*Server, PostgreSQL etc) and web scripting/programming language(Perl, PHP, Ruby, Java, ASP, etc)...
3
3335
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading...
10
6015
by: MHenry | last post by:
Hi, We were going merrily along for 6 years using this database to record all client checks that came into our office, including information about what the checks were for. Suddenly, network...
5
3673
by: premmehrotra | last post by:
I currently have a multi-user access database which is put on a shared drive L: on a Windows Servers. Entire database is one file premdb.mdb. Users access this database from their laptops....
8
3119
by: John Baker | last post by:
Hi: I am URGENTLY in need of some book or web site OR tool that will help me integrate a relatively simple access application into a web page or pages. This is a time recording system (by...
1
1839
by: Claus Haslauer | last post by:
Hi, firstly, I am new to access03 and server03 Originally, I had written an access 2002 database. Then, we transferred (for another reason) to server 2003. Then, we got access 2003. Then I...
15
2518
by: philip | last post by:
On a form, I have a datagridview. This datagridview is constructed on a dataset filled by a tableadapter. The table adapter do very well what it must do when filling dataset. Insertions,...
7
2895
by: Allison | last post by:
Hi -- we are a small manufacturing looking for a multi-user database to take customer orders (nothing too complicated, with 3 users total). We think we should be using Access, but are wondering...
18
9100
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
21
4056
by: nihad.nasim | last post by:
Hi there, I have a database in Access that I need on the web. The web page should connect to the database and write records for certain tables and view records for others. I want to know a...
0
7040
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
7080
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6736
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5331
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4478
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1299
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
561
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.