Solved

Servlets and Databases (MS ACCESS)

Posted on 2002-04-02
7
175 Views
Last Modified: 2013-11-24
Lets say I have a record in the database and I would like to delete it. How do I do it coz. The code I have does not allow me to do that and I only List the records in the database

I'm stack I need your help with sample codes

Thank you

0
Comment
Question by:TreI
[X]
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
7 Comments
 
LVL 3

Expert Comment

by:jerelw
ID: 6914011
Instead of using executeQuery(String sql), user executeUpdate(String sql) and simply do a DELETE FROM [ TABLE ] WHERE COLUMN = [ CRITERIA ]+
0
 
LVL 1

Expert Comment

by:jose_tijo
ID: 6915142

Hi
try {
   //Create connection connection
   //Create Statement
          stmt = connection.createStatement();
   //Create SQL
      sql = "Delete from <tablename> where <condition>"
   //Execute

      records_Changed = stmt.executeUpdate(sql);
   
      if(records_Changed > 0)
            //Successfull
      else
            //Failure
}catch(Exception e) {
   //Exception Handling
 }  

Hope this helps you
 
             
0
 
LVL 4

Accepted Solution

by:
m_onkey_boy earned 50 total points
ID: 6916188
--- This guy never grades his questions ---
0
Industry Leaders: 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!

 
LVL 3

Expert Comment

by:jerelw
ID: 6916722
This sounds like homework, too.
0
 

Author Comment

by:TreI
ID: 6936581
The last answer you gave me was very excellent. My question was about record deletion  in a database, your answer did work. Thanks so much, that was cool.  
0
 
LVL 3

Expert Comment

by:jerelw
ID: 6936770
?
0
 
LVL 4

Expert Comment

by:m_onkey_boy
ID: 6937030
thanks!
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

691 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