467,143 Members | 1,166 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,143 developers. It's quick & easy.

Delete Multipul value from database

Fary4u
100+
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
Expand|Select|Wrap|Line Numbers
  1. <%
  2. dim ors,ocon
  3. set ocon = server.createobject("ADODB.Connection")
  4. ocon.open ConString
  5. set ors = server.createobject("ADODB.RecordSet")
  6. dim a
  7. a= Trim(request("nam"))
  8. ors.open "select * from products where productID=" & a,ocon,adOpenDynamic,adLockOptimistic
  9.     if (a = "") then
  10.         response.redirect "admin.asp"
  11.     end if
  12.  
  13.     if ors.eof then
  14.         response.write" <p align=center><b><font face=Verdana color=#800000><br><br><br>Sorry there is no Record in database</font></b></p> "
  15.     else
  16.         ors.delete
  17.         ors.update
  18.  
  19.         dim orscol,oconcol
  20.         set oconcol = server.createobject("ADODB.Connection")
  21.         oconcol.open ConString
  22.         set orscol = server.createobject("ADODB.RecordSet")
  23.             orscol.open "select * from PRODUCT_SIZES where prod_id=" & a,oconcol,adOpenDynamic,adLockOptimistic
  24.  
  25.                 if ors.eof then
  26.                     response.write"Sorry"
  27.                 else
  28.                     response.write "ok"
  29.                     orscol.delete
  30.                     orscol.update
  31.                 end if
  32.  
  33.         orscol.close
  34.         set orscol=Nothing
  35.         oconcol.close
  36.         set oconcol=Nothing
  37.  
  38.         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> "
  39.         response.write" <p align=center><form action='index.asp'><input type='submit' value='Go Back'></form></p>"
  40.     end if
  41. ors.close
  42. set ors=Nothing
  43. ocon.close
  44. set ocon=Nothing
  45. %>
Feb 18 '08 #1
  • viewed: 1187
Share:
3 Replies
DrBunchman
Expert 512MB
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
Feb 19 '08 #2
Fary4u
100+
i just need to deleted record from 2nd table it's doesn't do any ting
Feb 19 '08 #3
DrBunchman
Expert 512MB
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
Feb 19 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Robert Schneider | last post: by
6 posts views Thread by Mark Kurten | last post: by
13 posts views Thread by mac | last post: by
reply views Thread by Slickuser | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.