?
Solved

search page on web site

Posted on 2003-02-26
10
Medium Priority
?
154 Views
Last Modified: 2010-04-06
I have a search.asp page connected to an access db. The db
stores a table with an id field,doc title, date, hit
count, and keyword field along with two other tables, loc
and dept. After the user chooses the loc and dept and
whatever other search parameters, keyword etc. the results
are displayed with hyperlinks to the docs. the id field is
passed to another page, view.asp to display the doc chosen
and update the db with the hit count. The docs are stored
in another folder outside the db. The problem  is I am
receiving an error that the db or object is read only (I
know it is not) the error references view.asp line 10. I
have had all folders and files along with the db checked
for privileges and it all checks out. Below is my view.asp
any ideas? Thanks!!!

<% @ Language="Vbscript"%>
<%Dim adoconn,adoRs
set adoConn=server.createObject("ADODB.Connection")
adoConn.ConnectionString="Driver=Microsoft Access Driver
(*.mdb);DBQ=" & Server.MapPath("Policy.mdb")
adoconn.Open
set adors=server.CreateObject("ADODB.Recordset")
adoRs.Open "select * from Policy where PolicyId ='" & 
request("PolicyId") &"'",adoConn,3,3
if not adoRs.EOF then
     adoRs.Fields("HitCount")=adoRs.Fields("HitCount")+1
     adoRs.Update
%>
<html>
<Title><%=adoRs.Fields("PolicyName")%></title>
<script language="Javascript">
function doit(){
     document.location.href="<%=adors.Fields
("document")%>"
}
</script>
<body onLoad=doit();>
</body></html>
<%adoRs.Close
adoconn.Close
end if
%>

0
Comment
Question by:wsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 15

Expert Comment

by:gladxml
ID: 8031305
wsa,

try to add this line before your adors.Open

Const adOpenStatic = 3
Const adLockOptimistic = 3
0
 
LVL 15

Expert Comment

by:gladxml
ID: 8031319
wsa,

because you are using

adLockOptimistic 3
Optimistic locking, record by record. The provider lock records only when calling update

0
 

Author Comment

by:wsa
ID: 8046013
Thanks, I tried this and received the same error. How are the constraints interpretted? I thought:

adOpenDynamic
adOpenForwardOnly
adOpenKeyset
adOpenStatic

adLockBatchOptimistic
adLockOptimistic
asLockPessimistic
adLockReadOnly

are they interpreted 0,1,2,3 respectively?
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 15

Expert Comment

by:gladxml
ID: 8046168
wsa,

Could you just try this out first and check the result... without the locktype and cursortype..

set adors=server.CreateObject("ADODB.Recordset")
adoRs.Open "select * from Policy where PolicyId ='" & 
request("PolicyId") &"'",adoConn

0
 
LVL 15

Expert Comment

by:gladxml
ID: 8046174
wsa,

Below is the link with the complete description regarding cursortype and locktype properties...

http://www.w3schools.com/ado/prop_rs_locktype.asp

http://www.w3schools.com/ado/prop_rs_cursortype.asp

HTH...

Happy programming...
0
 

Author Comment

by:wsa
ID: 8059380
Thanks gladxml for all your help
Sorry it has taken long to respond, I did not have access to the server until today. I removed the locktype and cursortype and received the fllowing error:

Recordset error

Current Recordset does not support updating. This may be limitation of the provider, or of the selected locktype.

view.asp line9

You have been a great help!
0
 

Author Comment

by:wsa
ID: 8059456
Thanks gladxml for all your help
Sorry it has taken long to respond, I did not have access to the server until today. I removed the locktype and cursortype and received the fllowing error:

Recordset error

Current Recordset does not support updating. This may be limitation of the provider, or of the selected locktype.

view.asp line9

You have been a great help!
0
 
LVL 15

Accepted Solution

by:
gladxml earned 800 total points
ID: 8061491
wsa,

Colud you please give the below code a try... I do some revision with your original code...

=====
<% @ Language="Vbscript"%>
<%Dim adoconn,adoRs
set adoConn=server.createObject("ADODB.Connection")
adoConn.ConnectionString="Driver=Microsoft Access Driver
(*.mdb);DBQ=" & Server.MapPath("Policy.mdb")
adoconn.Open

set adors=server.CreateObject("ADODB.Recordset")
adoRs.Open "select * from Policy where PolicyId ='" & 
request("PolicyId") &"'",adoConn

if not adoRs.EOF then
     count =cint(adoRs("HitCount"))+1
     sqlstr="UPDATE Policy Set " & " HitCount =" & count & " WHERE PolicyId = '" & request("PolicyId") & "';"
     adoconn.execute sqlstr, recordaffected, 1

     adoRs.Close
     adoconn.Close

     response.redirect adoRs("document")

end if


%>
0
 

Author Comment

by:wsa
ID: 8075379
Thanks gladxml you have put in as much time as I have on this! It still won't update, but ... I'll keep on it Thanks for all you help
0
 
LVL 15

Expert Comment

by:gladxml
ID: 8229806
wsa,

Sorry for the late response. I had deleted the email notification regarding this question and it seem that you still need some help..

Try to check the below link might help...

http://www.w3schools.com/ado/ado_query.asp

http://www.w3schools.com/ado/showasp.asp?filename=demo_query_4

Hope this help...

HAppy programming...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question