Problem with deleting records using jquery with classic asp

Problem with deleting records using jquery with classic asp

Hi

I'm using jquery to pass trough data to another page where I want to insert and delete a record. But the problem is that jquery only inserts or deletes the records and not both together.

I use following code:
For jquery:
  1. $(document).ready(function(){
  2. $("#btnAddPayment").click(payment);
  3. });


  4. //example 1
  5. function payment(){

  6. $.ajax({
  7. type:"POST",
  8. url: "acceptPaymentExecute.asp",
  9. dataType: "application/x-www-form-urlencoded",
  10. data: "amount=" + $("#amount").val() + "&reason=" + $("#reason").val() + "&bookingDate=" + $("#bookingDate").val() + "&accountNumber=" + $("#accountNumber").val() + "&memberID=" + $("#memberID").val() + "&memberPaymentID=" + $("#memberPaymentID").val(),
  11. success: function(msg){ $("#fldPayment").append(msg);}
  12. })
  13. }
In my acceptPaymentExecute.asp page:
  1. amount = Request("amount")
  2. bookingdate = Request("bookingDate")
  3. reason = Request("reason")
  4. accountNumber = Request("accountNumber")
  5. memberID = Request("memberID")
  6. memberPaymentID = Request("memberPaymentID")

  7. set objConn = Server.CreateObject("ADODB.Connection")
  8. set objRS = Server.CreateObject("ADODB.Recordset")
  9. objConn.open conn

  10. yearDate = Year(bookingdate)
  11. bookDate = Year(bookingdate) & "-" & Month(bookingdate) & "-" & Day(bookingdate)

  12. strInsertPayment = "INSERT INTO payment(memberID,amount,bookingdate,reasonPayment,paymentYear,accountNumber) VALUES (" & memberID & "," & amount & ",'" & bookDate & "','" & reason & "'," & yearDate & "," & accountNumber & ");"
  13. strDeleteMemberPayment = "DELETE FROM memberPayment WHERE memberPaymentID = " & memberPaymentID & ";"

  14. objRS = objConn.execute(strInsertPayment)
  15. objRS = objConn.execute(strDeleteMemberPayment)

  16. objRS.close()
  17. set objRS = nothing
  18. objConn.close()
  19. set objConn = nothing
The queries work but not together. If I comment the insert statement, my page executes the delete statement, ...
I already tried to call another object for my delete statement but it does the same.

Can somebody help me with this problem?