Delete Multipul value from database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    #1

    Delete Multipul value from database

    Hi

    is any body find out where is the problem is ?

    i've got product value in 2 different tables it's remove from 1st table but how can i remove it from 2nd table

    PROBLEM IN LINE 23

    code is here
    Code:
    <%
    dim ors,ocon
    set ocon = server.createobject("ADODB.Connection")
    ocon.open ConString
    set ors = server.createobject("ADODB.RecordSet")
    dim a
    a= Trim(request("nam"))
    ors.open "select * from products where productID=" & a,ocon,adOpenDynamic,adLockOptimistic
    	if (a = "") then
    		response.redirect "admin.asp"
    	end if
    
    	if ors.eof then
    		response.write" <p align=center><b><font face=Verdana color=#800000><br><br><br>Sorry there is no Record in database</font></b></p> "
    	else
    		ors.delete
    		ors.update
    		
    		dim orscol,oconcol
    		set oconcol = server.createobject("ADODB.Connection")
    		oconcol.open ConString
    		set orscol = server.createobject("ADODB.RecordSet")
    			orscol.open "select * from PRODUCT_SIZES where prod_id=" & a,oconcol,adOpenDynamic,adLockOptimistic
    			
    				if ors.eof then
    					response.write"Sorry"
    				else
    					response.write "ok"
    					orscol.delete
    					orscol.update
    				end if
    
    		orscol.close
    		set orscol=Nothing
    		oconcol.close
    		set oconcol=Nothing
    			
    		response.write" <p align=center><b><font face=Verdana color=#800000><br><br><br>Your Record has been Deleted from the database successfully</font></b></p> "
    		response.write" <p align=center><form action='index.asp'><input type='submit' value='Go Back'></form></p>"
    	end if
    ors.close
    set ors=Nothing
    ocon.close
    set ocon=Nothing
    %>
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi there,

    What's happening when you run this? Is it erroring or is it just not deleting the second recordset as you would expect it to?

    Dr B

    Comment

    • Fary4u
      Contributor
      • Jul 2007
      • 273

      #3
      i just need to deleted record from 2nd table it's doesn't do any ting

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        I think it's just a typo. Check out line 25 - shouldn't it say:

        "if oRSCol.EOF Then" rather than "if oRS.EOF" ??

        It's checking the previous recordset rather than the one you've just opened. Give it a try and let me know how you get on.

        Hope this helps,

        Dr B

        Comment

        Working...