delete records in msaccess database using checkboxes

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,
                sangita
sangitasabaleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kennethxuCommented:
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="";

/*****************************************************/
%>
<center>

<form method="post" name=formnewquote>

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

<h3>Item List</h3>

<!-- Start List of Item(s) -->
<table>
 <tr>
   <th><div align="center"></div></td>
   <th>Item Name</td>
   <th>Qty</td>
   <th>Unit</td>
   <th>Unit Price</td>
   <th>Offer Price</td>
 </tr>
 <%
int ii = 0;
if (itemname!=null) {
 for (int k=0;k<isChecked.length;k++) {
    if ( ! ( doDelete && isChecked[k] ) ) {
      %>
 <tr>
   <td> <div align="center">
       <input type="checkbox" name="chkbox" value="<%=ii%>">
     </div></td>
   <td><div align="center">
       <input name="itemname" type=text value="<%=itemname[k]%>" size="17">
     </div></td>
   <td><div align="center">
       <input name="qty" type=text value="<%=qty[k]%>" size="5">
     </div></td>
   <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>
       </select>
     </div></td>
   <td><div align="center">
       <input name="unitprice" type=text value="<%=unitprice[k]%>" size="8">
     </div></td>
   <td><div align="center">
       <input name="offerprice" type=text value="<%=offerprice[k]%>" size="8">
     </div></td>
 </tr>
 <%
        ii ++;
    }
 } //for
} //if

if( "Add".equals( action )  || itemname == null ) {
%>
 <tr>
   <td><div align="center">
       <input type="checkbox" name="chkbox" value="<%=ii%>">
     </div></td>
   <td><div align="center">
       <input name="itemname" type="text" size="17">
     </div></td>
   <td><div align="center">
       <input name="qty" type="text" size="5">
     </div></td>
   <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>
       </select>
     </div></td>
   <td><div align="center">
       <input name="unitprice" type="text" size="8">
     </div></td>
   <td><div align="center">
       <input name="offerprice" type="text" size="8">
     </div></td>
 </tr>
 <% } %>
 <td colspan="6">
     <a href="javascript:checkall('formnewquote','chkbox',true)">All</a>/<a
     href="javascript:checkall('formnewquote','chkbox',false)">None</a>
 <input type=submit value="Delete Selected Item" name="action"></td>
 </tr>
 <tr>
   <td colspan="6"><input type=submit value="Add" name="action" ></td>
 </tr>
</table>
</form>
</center>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
girionisCommented:
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.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.