Link to home
Start Free TrialLog in
Avatar of crosstf
crosstfFlag for United States of America

asked on

I get a Microsoft OLE DB Provider for ODBC Drivers error '80040e23' error

If I update a cart quantity of zero, I get this error

Microsoft OLE DB Provider for ODBC Drivers error '80040e23'

Row handle referred to a deleted row or a row marked for deletion.

The table in question does have a UID, and I need to use a non-UID to identify the row. It is okay that it updates or deletes all rows associated.
while not rsProd.EOF
 
            element = "quant" & rsProd("productID")
            intQuant = Request.form(element)
 
            if intQuant <> "" and isNumeric(intQuant) then
                if intQuant = 0 then
                    rsProd.Delete
               else
                   rsProd("quantity") = intQuant
               end if
            end if
            rsProd.Update
            rsProd.MoveNext
        wend
 
        if Request.form("control") = "Update Order" then
 
             rsProd.Close
             set rsProd = Nothing
     
          
 
             Response.Redirect "page.asp"
         else
         
         if rsProd.BOF and rsProd.EOF then
				rsProd.Close
				set rsProd = Nothing
			
				Conn.Close
				set Conn = Nothing
				
				Session("orderID") = ""
				Response.Redirect "page.asp"
			 
		else

Open in new window

Avatar of golfDoctor
golfDoctor

You cannot delete a record and then refer to it.
 if intQuant <> "" and isNumeric(intQuant) then
                if intQuant = 0 then
                    rsProd.Delete   'CANNOT DELETE HERE
               else
                   rsProd("quantity") = intQuant
               end if
            end if
            rsProd.Update  'THEN REFER TO THE RECORD HERE
 
 
Try this:
 
 if intQuant <> "" and isNumeric(intQuant) then
                if intQuant = 0 then
                    rsProd.Delete
               else
                   rsProd("quantity") = intQuant
                   rsProd.Update
               end if
            end if
           

Open in new window

Avatar of crosstf

ASKER

This does the same thing. If I have more than one item coming in 0, and update, it throws the db error. Is there a way to not delete until after the update?
Avatar of crosstf

ASKER

I have to handle zero as an integer. Even if we have to get rid of if inQuant  =0 somehow, that is fine.
POST THE ERROR LINE!  SHEESH!
"Is there a way to not delete until after the update?"

Why would this ever be necessary, update and then delete the record?


"I have to handle zero as an integer"

Zero IS an integer, there's no problem with that.


You should ALWAYS post the error message, AND the error code on that line.  Otherwise we're just guessing.
Avatar of crosstf

ASKER

Microsoft OLE DB Provider for ODBC Drivers error '80040e23'

Row handle referred to a deleted row or a row marked for deletion.
file.asp, line 255
sql = "select * from table where columnID = '" & session("columnID") & "'"
            rsProd.open sql, Conn1, 3, 3 
		
			
			 
        while not rsProd.EOF
 
            element = "quant" & rsProd("productID")
            intQuant = Request.form(element)
 
          if intQuant <> "" and isNumeric(intQuant) then
                if intQuant = 0 then
                    rsProd.Delete
               else
                   rsProd("quantity") = intQuant
                   rsProd.Update
               end if
            end if
            rsProd.MoveNext  ---> Line 255 
        wend
 
        if Request.form("control") = "Update Order" then
 '
             rsProd.Close
             set rsProd = Nothing
     
 
             Response.Redirect "page.asp"
         else
         
         if rsProd.BOF and rsProd.EOF then
				rsProd.Close
				set rsProd = Nothing
			
				Conn1.Close
				set Conn1 = Nothing
				
				Session("columnID") = ""
				Response.Redirect "page.asp"
			 
		else
 
<!-- Rest of HTML CODE-->

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of golfDoctor
golfDoctor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of crosstf

ASKER

while not rsProd.EOF

            element = "quant" & rsProd("productID")
            intQuant = Request.form(element)

   
     
                   rsProd("quantity") = intQuant
                   rsProd.Update
           
            
            rsProd.MoveNext
        wend
            
      sql1= "DELETE FROM itemsOrdered where quantity= 0"
      conn1.execute(sql1)
If you got the correct answer, then you should give an A.  Why a B?
I managed to solve this error by changing the cursor type of the recordset from static (3) to keyset (1)