delete records in msaccess database using checkboxes

Posted on 2003-03-21
Medium Priority
Last Modified: 2010-04-01
I am creating a .jsp file .My dbase is in Msaccess.I am retriving fields from dbase table.I want to delete seleted records Using checkboxes .Plz
help me to create link between selected checkboxes and Field to be deleted.
 thanking u,
Question by:sangitasabale
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Accepted Solution

kennethxu earned 200 total points
ID: 8181389
study this code, and you'll know how to deal with checkbox, let me know if you have further enquires.

String action=request.getParameter("action");
String[] itemname = request.getParameterValues("itemname");
String[] qty =  request.getParameterValues("qty");
String[] unit = request.getParameterValues("unit");
String[] unitprice = request.getParameterValues("unitprice");
String[] offerprice = request.getParameterValues("offerprice");
String[] chkbox = request.getParameterValues("chkbox");

boolean doDelete = "Delete Selected Item".equals( action );
boolean[] isChecked = null;

if( itemname != null ) isChecked = new boolean[ itemname.length ];
if( doDelete && chkbox != null ) {
 for( int jj = 0; jj<chkbox.length; jj ++ ) {
      int index = Integer.parseInt( chkbox[jj] );
      // out.println( "got " + index );
      isChecked[index] = true;

if (action==null) action="";


<form method="post" name=formnewquote>

<% //if (action.equals("Submit")){ %>
<%  //@include file = "process_nq1.jsp"%>
<% //} %>

<h3>Item List</h3>

<!-- Start List of Item(s) -->
   <th><div align="center"></div></td>
   <th>Item Name</td>
   <th>Unit Price</td>
   <th>Offer Price</td>
int ii = 0;
if (itemname!=null) {
 for (int k=0;k<isChecked.length;k++) {
    if ( ! ( doDelete && isChecked[k] ) ) {
   <td> <div align="center">
       <input type="checkbox" name="chkbox" value="<%=ii%>">
   <td><div align="center">
       <input name="itemname" type=text value="<%=itemname[k]%>" size="17">
   <td><div align="center">
       <input name="qty" type=text value="<%=qty[k]%>" size="5">
   <td><div align="center">
     <select name="unit" >
         <option value="kg" <% if ("unit[k]".equals("kg")) out.println("selected");%>>Kg</option>
         <option value="ctn" <% if ("unit[k]".equals("kg")) out.println("selected");%>>Cartons</option>
         <option value="pkt" <% if ("unit[k]".equals("kg")) out.println("selected");%>>Packet</option>
         <option value="tons" <% if ("unit[k]".equals("kg")) out.println("selected");%>>Tons</option>
   <td><div align="center">
       <input name="unitprice" type=text value="<%=unitprice[k]%>" size="8">
   <td><div align="center">
       <input name="offerprice" type=text value="<%=offerprice[k]%>" size="8">
        ii ++;
 } //for
} //if

if( "Add".equals( action )  || itemname == null ) {
   <td><div align="center">
       <input type="checkbox" name="chkbox" value="<%=ii%>">
   <td><div align="center">
       <input name="itemname" type="text" size="17">
   <td><div align="center">
       <input name="qty" type="text" size="5">
   <td><div align="center">
     <select name="unit">
         <option value="kg">Kg</option>
         <option value="ctn">Cartons</option>
         <option value="pkt">Packet</option>
         <option value="tons">Tons</option>
   <td><div align="center">
       <input name="unitprice" type="text" size="8">
   <td><div align="center">
       <input name="offerprice" type="text" size="8">
 <% } %>
 <td colspan="6">
     <a href="javascript:checkall('formnewquote','chkbox',true)">All</a>/<a
 <input type=submit value="Delete Selected Item" name="action"></td>
   <td colspan="6"><input type=submit value="Add" name="action" ></td>
LVL 35

Expert Comment

ID: 10060221
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to kennethxu

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
New style of hardware planning for Microsoft Exchange server.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month12 days, 22 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question