473,378 Members | 1,375 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,378 software developers and data experts.

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 1456
"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
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
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
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
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
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
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
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
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
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
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.