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

Question on a 'Hits' column in User Table

I currently have a User table in my database that has the columns:

Username
FirstName
LastName
Email
LastActivityDate

I created a page on the website in a DotNetNuke reports module where a query is executed that displays all of the user information. I've gotten that to execute properly. I have now created another column in the database table titled 'Hits'

I am trying to get Hits to be incremented by 1 based off of a change in LastActivityDate. So basically each time a user is active on my page a 1 will be added to their 'Hits' in the database table. I've never posted here so if this is in the wrong forum I apologize. Any help would be appreciated!

Thanks

I have tried this and it executes but it will obviously add a hit each time the page is loaded which is not what I am looking for.

UPDATE Users
SET Hits=Hits+1
WHERE Users.LastActivityDate >= '12/23/2008 3:10:38 AM'
Dec 23 '08 #1
1 1497
ck9663
2,878 Expert 2GB
How do you update LastActivityDate column? Do you update it every time the user access the table? If you do, just update the hits every time you update the LastActivityDate column.

Something like:
Expand|Select|Wrap|Line Numbers
  1.  
  2. UPDATE Users
  3. SET Hits=Hits+1,LastActivityDate = getdate()
  4. WHERE UserName = VariableFromYourSite
  5.  
  6. .
Your options are:

Create a stored proc that will handle all this

or

Build the query from your front end and execute dynamically.

--CK
Dec 23 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Guinness Mann | last post by:
Greetings, I think I saw an article yesterday in which you told someone not to make an Identity column a primary key. I seem to remember you saying something like "It undermines the entire...
10
by: Paulo Jan | last post by:
Hi all: Let's say I'm designing a database (Postgres 7.3) with a list of all email accounts in a certain server: CREATE TABLE emails ( clienteid INT4, direccion VARCHAR(512) PRIMARY KEY,...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
28
by: cjobes | last post by:
Hi all, I need to populate a listbox from a table column. The column has multiple entries of usernames and I need to pull a unique set of usernames. The table is part of an untyped Dataset that...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
9
by: David Eades | last post by:
Hi all Complete newbie here, so apologies if this is the wrong forum. I've been asked to use mysql and asp to make a simple bidding system (rather like a simple ebay), whereby users can use a...
3
by: maximisedk | last post by:
I need to create a HTML table for a number of users. Each user will have a unique HTML table in regard to number of columns, as the user can choose to append columns to his HTML table. The way I...
5
by: jehugaleahsa | last post by:
Hello: What is the point of using a DataTable in ASP .NET? We are unsure how you can use them without 1) rebuilding them every postback, or 2) taking up precious memory. We are not sure how to...
1
by: pitjpz | last post by:
We have moved our Database to another server. The server it was on used SQL 4 and the new one its on now uses SQL5 the only problem we can find is that when you attempt to delete a record from...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.