Solved

Servlets and Databases (MS ACCESS)

Posted on 2002-04-02
7
170 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Eclipse with gitlab 1 163
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 77
Selenium docs api java index 3 68
running on tomcat not jboss eap 7.0 3 32
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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.

733 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