Solved

Servlets and Databases (MS ACCESS)

Posted on 2002-04-02
7
158 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
7 Comments
 
LVL 3

Expert Comment

by:jerelw
Comment Utility
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
Comment Utility

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
Comment Utility
--- This guy never grades his questions ---
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 3

Expert Comment

by:jerelw
Comment Utility
This sounds like homework, too.
0
 

Author Comment

by:TreI
Comment Utility
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
Comment Utility
?
0
 
LVL 4

Expert Comment

by:m_onkey_boy
Comment Utility
thanks!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now