Home > ASP Development > 2 request value and databse connect

2 request value and databse connect



Hi all,

i have 4 databse field there is userid,question,questionid and answer fields, when i reply to answer occording to questionid or comparing with questionid field there is giving me error plase look below codes:



<%

dim db

dim qid,ans

qid=request.form("qid")

ans=request.form("ans")

set db=server.CreateObject("adodb.connection")

db.open("provider=microsoft.Jet.OLEDB.4.0;data source=\mydb\mydb.mdb")

dim rs

set rs=server.createobject("adodb.recordset")

rs.open "select * from problem",db

rs("questionid")=qid

rs("answer")=ans

if rs.eof and rs.bof then

response.write "cant answer"

else

rs.move first

while not rs.eof

rs.addnew

rs("answer")=ans

rs.update

rs.movenext

wend

end if

%>



how can i solve this problem please help me

    
Guest


HI,
what error are you getting?
the first thing that I see is this

rs.move first

it should be one word:

rs.movefirst

Was this answer helpful ? Yes No   
Guest


i did that but same problem

error is:

ADODB.Recordset error '800a0cb3'



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



/control/answercheck.asp, line 11





........................

Quote:
Originally Posted by nofriends
HI,

what error are you getting?

the first thing that I see is this



rs.move first



it should be one word:



rs.movefirst

Was this answer helpful ? Yes No   
Guest


try replacing

Code:


 rs.open "select * from problem",db
 



with the correct locktype

Code:


 rs.open "select * from problem",db, 3
 



hope this helps

Was this answer helpful ? Yes No   
Guest


i did but same error message.

i did like this other example

but this source also not working

.............................

<%

dim db

dim ui,ans

ui=request.form("userid")

ans=request.form("ans")

set db=server.CreateObject("adodb.connection")

db.open("provider=microsoft.Jet.OLEDB.4.0;data source=\codesdb\codesdb.mdb")

dim rs

set rs=server.createobject("adodb.recordset")

rs.open "select * from problem where userid='" & ui,ans & "'",db

if rs.eof and rs.bof then

response.write "no update"

else

rs.movefirst

while not rs.eof

rs("answer")=ans

rs.movenext

wend

end if

%>

........................





Quote:
Originally Posted by nofriends
try replacing


Code:



rs.open "select * from problem",db




with the correct locktype


Code:



rs.open "select * from problem",db, 3




hope this helps

Was this answer helpful ? Yes No   
Guest


As this links in to an access database, does the IIS local user ( IUSR_**computername**) have read/write access to the folder containing the database & the file?



hope this helps

Was this answer helpful ? Yes No   
Guest


Yes it is! its read/write access.

other table are working fine.

error:

ADODB.Recordset error '800a0cb3'



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



/control/answercheck.asp, line 11





Quote:
Originally Posted by iht4
As this links in to an access database, does the IIS local user ( IUSR_**computername**) have read/write access to the folder containing the database & the file?



hope this helps

Was this answer helpful ? Yes No   
Guest


Ok, try this:


Code:



<%
dim db
dim qid,ans
qid=request.form("qid")
ans=request.form("ans")
set db=server.CreateObject("adodb.connection")
db.open("provider=microsoft.Jet.OLEDB.4.0;data source=\mydb\mydb.mdb")
dim rs
set rs=server.createobject("adodb.recordset")
rs.open "select * from problem WHERE QID = " & qid & " AND ANSWER = '" & ans & "'",db, 3
if rs.eof and rs.bof then
response.write "cant answer"
else
while not rs.eof
rs("answer")=ans
rs.update
rs.movenext
wend
end if
%>




I am not sure what you are trying to do here, the logic doesn't seem right to me,

you are selecting values where the question and answer match, then you are updating

those same records with the same answer?

Was this answer helpful ? Yes No   
Guest


Microsoft JET Database Engine error '80040e14'

Syntax error (missing operator) in query expression 'QID = AND ANSWER = '''.

/control/answercheck.asp, line 10

Was this answer helpful ? Yes No   
Guest


i did like this

<%
dim db
dim qid,ans
qid=request.form("qid")
ans=request.form("ans")
set db=server.CreateObject("adodb.connection")
db.open("provider=microsoft.Jet.OLEDB.4.0;data source=\codesdb\codesdb.mdb")
dim rs
set rs=server.createobject("adodb.recordset")
rs.open "select * from problem WHERE questionid = " & qid & " and answer= '" & ans & "'",db
if rs.eof and rs.bof then
response.write "cant answer"
else
while not rs.eof
rs("answer")=ans
rs.update
rs.movenext
wend
end if
%>

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved