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

DB not unlocking?

I have a simple asp page that opens an mdb, reads it, updates 1
record, closes it. Here's the code:

Set Conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
serverr.MapPath ("LAUSDNutriCounter.mdb")
Rs.CursorType = 2
Rs.LockType = 3

strSQL = "SELECT * FROM NutriCounter"
Rs.Open strsql, Conn
unlockednum = rs.fields("Unlocked")
rs.fields("Unlocked") = unlockednum - 1
rs.update
rs.close
Conn.Close
set rs = nothing
Set Conn = Nothing

This page works fine the first time its ran. But if you run it within
60 seconds again it comes up with the error "An error occurred on the
server when processing the URL". I've tracked down where it errors
and it is the line "Conn.Open ...". However, if i wait 60 seconds or
more between running the page it works.

Is there some kind of lock on the db that is not letting go for 60
seconds?

Please help and thanks in advance,

Brandon
Jul 19 '05 #1
2 1349
Have you tried a much simpler approach?

set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("LAUSDNutriCounter.mdb")
' are you sure you don't want a WHERE clause here?
' just update the whole table? why?
sql = "UPDATE NutriCounter SET Unlocked = Unlocked - 1"
conn.execute sql, , 129
conn.close
set conn = nothing

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Brandon Lepley" <bj******@napuda.com> wrote in message
news:2a**************************@posting.google.c om...
I have a simple asp page that opens an mdb, reads it, updates 1
record, closes it. Here's the code:

Set Conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
serverr.MapPath ("LAUSDNutriCounter.mdb")
Rs.CursorType = 2
Rs.LockType = 3

strSQL = "SELECT * FROM NutriCounter"
Rs.Open strsql, Conn
unlockednum = rs.fields("Unlocked")
rs.fields("Unlocked") = unlockednum - 1
rs.update
rs.close
Conn.Close
set rs = nothing
Set Conn = Nothing

This page works fine the first time its ran. But if you run it within
60 seconds again it comes up with the error "An error occurred on the
server when processing the URL". I've tracked down where it errors
and it is the line "Conn.Open ...". However, if i wait 60 seconds or
more between running the page it works.

Is there some kind of lock on the db that is not letting go for 60
seconds?

Please help and thanks in advance,

Brandon

Jul 19 '05 #2
That worked beautifully except 1 thing. I need to set the variable
"unlockednum" = dbfield "unlocked" so I can make sure it is greater
than 0. Can you help me out with that? Do I need to use a RS object
or can that be done with the Conn object?

Thanks!!!!

Brandon

"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message news:<uG**************@TK2MSFTNGP09.phx.gbl>...
Have you tried a much simpler approach?

set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("LAUSDNutriCounter.mdb")
' are you sure you don't want a WHERE clause here?
' just update the whole table? why?
sql = "UPDATE NutriCounter SET Unlocked = Unlocked - 1"
conn.execute sql, , 129
conn.close
set conn = nothing

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Brandon Lepley" <bj******@napuda.com> wrote in message
news:2a**************************@posting.google.c om...
I have a simple asp page that opens an mdb, reads it, updates 1
record, closes it. Here's the code:

Set Conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
serverr.MapPath ("LAUSDNutriCounter.mdb")
Rs.CursorType = 2
Rs.LockType = 3

strSQL = "SELECT * FROM NutriCounter"
Rs.Open strsql, Conn
unlockednum = rs.fields("Unlocked")
rs.fields("Unlocked") = unlockednum - 1
rs.update
rs.close
Conn.Close
set rs = nothing
Set Conn = Nothing

This page works fine the first time its ran. But if you run it within
60 seconds again it comes up with the error "An error occurred on the
server when processing the URL". I've tracked down where it errors
and it is the line "Conn.Open ...". However, if i wait 60 seconds or
more between running the page it works.

Is there some kind of lock on the db that is not letting go for 60
seconds?

Please help and thanks in advance,

Brandon

Jul 19 '05 #3

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

Similar topics

1
by: Mr. M.J. Lush | last post by:
I'm writing a postgres database with a PHP front end for a small work-group , and I want to prevent two editors working on the same record at the same time overwriting each others entry's. The...
1
by: schwerdy | last post by:
Hello developers! I'm using Python 2.3.4 under debian Sarge and want to write a small logger class. My source code reads: #*************************************************** import sys, time...
1
by: serge calderara | last post by:
Dear all, For my application I need to handle licencing as every software. For that I have a demo licence and a runtime licence which can expired after 30 days for the demo and base on a date...
1
by: CoolFire | last post by:
Hello I have searched high and low for the answer to my question. I expect that it is right under my nose but it has come time for me to ask anyway. Is there a way to force access to a file on a...
10
by: boris.litvak | last post by:
We are looking for a command/SQL statement that cancels all table/row locks in DB2. The reason for this is: 1) computer A was a sole client of DB2, and crashed 2) computer B automatically (in our...
0
by: chris | last post by:
Cell Phone Repair & Unlocking Service, Fast Turn-Around & Great Prices! The Cell Shop http://www.cellphonerepair.org
0
by: jigar | last post by:
Hello, I want to know that is it possible to access the windows locking and unlocking (Ctl+Alt+Del) functionality from VC++ System programming . If possible then how? Is there any API or help...
3
by: NaeiKinDus | last post by:
Hello, i'm trying to program a thread that would be locked (by a mutex) and that would only be unlocked once that a function (generating data) is done. The purpose is to generate data, and unlock...
3
by: SoNew | last post by:
To say I'm new is an understatement - but somehow my boss decided I was the one to create a database in Access 2003...I'm nearly there. I have a small problem in that I have locked the main form...
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
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?
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.