Forums
This topic is locked
Increment DB Column +1
Posted 11 Jan 2006 05:29:00
1
has voted
11 Jan 2006 05:29:00 Jeremy Conn posted:
I have a somewhat easy question, I think.I am trying to update a DB column plus-1 everytime someone logs into a site I am building... the idea is to have the admin know how much people are using the website.
I am getting an error and I can't figure out what the problem is.
_________________________
<b>ERROR MESSAGE</b>
Microsoft Access Driver Engine error '80004005'
Could not update; currently locked.
/processlogin.asp, line 46
<b>CODE PAGE</b>
<% if(Session("MM_Username"



<%
set cmdCountLogin = Server.CreateObject("ADODB.Command"

cmdCountLogin.ActiveConnection = MM_connDB_STRING
cmdCountLogin.CommandText = "UPDATE Members SET LoginCount = LoginCount + 1 WHERE Username = '" + Replace(cmdCountLogin__OEColParam, "'", "''"

cmdCountLogin.CommandType = 1
cmdCountLogin.CommandTimeout = 0
cmdCountLogin.Prepared = true
cmdCountLogin.Execute() <font color=red><---- Line 46 Mentioned in the Error</font id=red>
%>
Any thoughts? Before you say it, "yes" I have set the permissions for the DB already.
Thanks in advance.
<b>Jeremy Conn</b>
www.conncreativemedia.com
DWMX2004 | ASP/VB | Access/SQL2000
Edited by - connman21 on 11 Jan 2006 06:35:10
Edited by - connman21 on 11 Jan 2006 08:16:15
Replies
Replied 11 Jan 2006 09:15:31
11 Jan 2006 09:15:31 Dave Clarke replied:
Do you have this code on the same page as your login code? if so that could be your problem because the login code has already locked your db while it does the login??
This is just a guess because i am using virtually the same code to count logins at www.reunite.co.uk but i have it on a seperate page, the login code redirects to the countlogin page once it makes a successful login and then the countlogin page redirects back again once it has updated the db.
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome.
This is just a guess because i am using virtually the same code to count logins at www.reunite.co.uk but i have it on a seperate page, the login code redirects to the countlogin page once it makes a successful login and then the countlogin page redirects back again once it has updated the db.
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome.
Replied 11 Jan 2006 18:42:42
11 Jan 2006 18:42:42 Jeremy Conn replied:
Good call - I'll try splitting them up and see how that works. I'll post back...
<b>Jeremy Conn</b>
www.conncreativemedia.com
DWMX2004 | ASP/VB | Access/SQL2000
<b>Jeremy Conn</b>
www.conncreativemedia.com
DWMX2004 | ASP/VB | Access/SQL2000
Replied 13 Jan 2006 01:43:30
13 Jan 2006 01:43:30 Jeremy Conn replied:
That fixed it... thanks, Dave.
For everyone else, I had to split the two Commands that wrote to the DB into 2 different pages.
This took away the problem of getting the "locked" database error.
<b>Jeremy Conn</b>
www.conncreativemedia.com
DWMX2004 | ASP/VB | Access/SQL2000
For everyone else, I had to split the two Commands that wrote to the DB into 2 different pages.
This took away the problem of getting the "locked" database error.
<b>Jeremy Conn</b>
www.conncreativemedia.com
DWMX2004 | ASP/VB | Access/SQL2000
Replied 13 Jan 2006 08:46:16
13 Jan 2006 08:46:16 Dave Clarke replied:
No problem <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> Glad you got it working.
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome.
www.parrotlinks.com
www.reunite.co.uk
ASP|VBScript|IIS5.1|Access|WinXPPro & WinXPHome.
www.parrotlinks.com
www.reunite.co.uk