DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007

    How to delete a specific entry in a GuestbookServlet


    I'm setting up Guestbook and evrything is working fine except when Im trying to Delete an entry from the Guestbook. I'm using a servlet to delete the entry from the database only it deletes all entries. How do I specify the SQL statement so it only deletes a specific one?

    My SQL statment looks like this ;

    state.executeUpdate("Delete Name, Comment, Date from Guestbook");

    Any thoughts?


  2. #2
    Join Date
    Mar 2005
    UK, London
    Each record in your database needs to have a unique id. When u want to view, edit or delete a particalr record you use the unique id.


    ID Name LastName
    1 Jon Doe
    2 Jane Smith
    3 Patrik O'Niel

    To delete the second record (Jane Smith) you would use the unique id, which is 2, so your sql statment would look like this


    The above sql will delete any record in your table, which the field ID contains 2. As the ID field only contains unique numbers, only one record will be deleted and that is the record which matches the ID number to be deleted. You can also use the unique ID to edit a record is needed. Hope that answers your question.

  3. #3
    Join Date
    May 2007
    Hi again,

    I am using Access for my database andfor the ID in each table there is an autonumber which sets a number to each entry. The problem is that the database somehow remembers which numbers were removed and sets the number for a new entry in the table as one after the entry that was deleted.
    Example: I have 3 entries in my table which have ID nr 1-3, I then remove all of them and enter 3 new entries in the same table. Those entries have the ID nr 4-6, not 1-3 which they should have. I have to figure out a way for access to number my table correctly.

    Anyways thanx for the swift reply/

  4. #4
    Join Date
    May 2007


    u write query like
    state.executeUpdate("Delete Name, Comment, Date from Guestbook");
    it delete all row from table Guestbook .you should specify the condition
    in where clause which row u want to delete

Similar Threads

  1. help reg creating ms access file
    By vbcoder in forum VB Classic
    Replies: 9
    Last Post: 04-28-2005, 12:36 PM
  2. OVERSEAS Online Data Entry Information
    By jai in forum Careers
    Replies: 0
    Last Post: 02-20-2003, 11:43 PM
  3. data entry jobs
    By harish boddapati in forum Careers
    Replies: 2
    Last Post: 02-20-2003, 06:48 AM
  4. Replies: 2
    Last Post: 11-27-2000, 06:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center