?
Solved

Servlets and Databases (MS ACCESS)

Posted on 2002-04-02
7
Medium Priority
?
179 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 200 total points
ID: 6916188
--- This guy never grades his questions ---
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

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!

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month11 days, 10 hours left to enroll

752 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