Solved

Servlets and Databases (MS ACCESS)

Posted on 2002-04-02
7
165 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
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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 114
why cannot we forward request once the response is committed 2 46
throw exception 21 58
ejb entity bean example issue 2 16
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 …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

808 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