getting error delete data with checkbox

Results 1 to 2 of 2

Thread: getting error delete data with checkbox

  1. #1
    jenny Guest

    Default getting error delete data with checkbox

    This is my code when i check on button all the data from screen gets delete no matter if i just check box . i want to delete those item from screen and database which is checked by user<BR>this my code<BR><BR><BR>&#060;% if request("deleteloc")&#060;&#062;"" then<BR> for each item in request("location")<BR> delsql = "delete from hr_rep_assignment " _<BR> & "where user_id = &#039" & userid & "&#039"<BR> Response.Write delsql <BR> set delrs.Activeconnection = conn<BR> delrs.Open delsql<BR> delrs.MoveNext <BR> next<BR> end if<BR>

  2. #2
    Nathen Grass Guest

    Default RE: getting error delete data with checkbox

    If you have the value for the checkbox set you can check for it and process it based on that. Also since you&#039re using an action query that&#039s not supposed to bring back a recordset you may be better off using just the connection object:<BR><BR>On your form:<BR>&#060;input type="checkbox" value="checked" name="test"&#062;<BR><BR>In your ASP:<BR>&#060;%<BR>Const adExecuteNoRecords = 128<BR><BR>if request("deleteloc")&#060;&#062;"" then<BR>&nbsp;&nbsp;&nbsp;for each item in request.form<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;If Request.Form(item) = "checked" then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;delsql = "delete from hr_rep_assignment " _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;& "where user_id = &#039" & userid & "&#039"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;Response.Write delsql <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;conn.Execute delsql,,adExecuteNoRecords<BR>&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;End If<BR>&nbsp;&nbsp;&nbsp;next<BR>end if<BR>%&#062;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts