Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move.next Problems

Status
Not open for further replies.

Johno2090

Programmer
May 3, 2002
31
0
0
GB
Ok thax for the help but i need more ive made a query to update a yes/no check box in a dtabase heres the code:

<% OPTION EXPLICIT %>
<!--#include file=&quot;common.inc&quot; -->
<%
dim Counter, counter2
dim str
dim strvalue
dim rsUpdate, strcollected

strvalue = request.form (&quot;hiddenvalue&quot;)


Set rsUpdate = Server.CreateObject(&quot;ADODB.Recordset&quot;)
strSQL = &quot;SELECT tblrequestedasp.collected From tblrequestedasp&quot;
rsUpdate.CursorType = 2
rsUpdate.LockType = 3

rsUpdate.Open strSQL, strCon

rsupdate.movelast

for counter = 0 to strvalue

strcollected = request.form (&quot;Collected&quot; & counter)

rsUpdate.Fields(&quot;Collected&quot;) = strcollected

rsUpdate.moveprevious
If rsUpdate.BOF Then Exit For
next

response.write &quot;Update Completed&quot;
%>

ERROR MESSAGE:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/toner/modify.asp, line 25
 
Is it any help that im trying to update a record?
 
thats not how you do an update, if it is ive never seen that syntax before, ill show you where I see problems:

strSQL = &quot;SELECT tblrequestedasp.collected From tblrequestedasp&quot;

rewrite to

strSQL = &quot;SELECT collected From tblrequestedasp&quot;

next:

for counter = 0 to strvalue

rewrite to:

for counter = 0 to clng(strvalue)
'make sure strvalue isnumeric before clng ing it


next

I think you think the following line performs an update, unfortunately its not that easy, the value is read only in the recordset you cannot update it in this manner:

rsUpdate.Fields(&quot;Collected&quot;) = strcollected

Your best bet:

go and find yourself a site that deals with basic SQL syntax, to update you will need to look for the SQL Update statement.

start here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top