The Artima Developer Community
Sponsored Link

Java Answers Forum
Help!!!!

3 replies on 1 page. Most recent reply: Mar 27, 2002 3:09 PM by Elliott Wood

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
Elliott Wood

Posts: 15
Nickname: tooess
Registered: Mar, 2002

Help!!!! Posted: Mar 26, 2002 2:07 PM
Reply to this message Reply
Advertisement
I'm trying to write a method that deletes a record from a ms access table but no matter what I do it won't delete. other queries and methods work fine .

The method is

public void deleteFromBook(String anISBN)throws SQLException
{
query = "DELETE * FROM book WHERE isbn ='" + anISBN+"'";
statement.executeUpdate(query);
}

Any ideas would be greatly appreciated thanks.


Mohit Gupta

Posts: 15
Nickname: mohit
Registered: Mar, 2002

Re: Help!!!! Posted: Mar 26, 2002 4:04 PM
Reply to this message Reply
try this ::

query = "DELETE book WHERE isbn ='" + anISBN+"'";

abhijeet

Posts: 13
Nickname: aaraje
Registered: Mar, 2002

Re: Help!!!! Posted: Mar 26, 2002 8:51 PM
Reply to this message Reply
Query may be wrong
delete * from is invalid query
instead you write delte from book where isbn="+ansiban+""

Elliott Wood

Posts: 15
Nickname: tooess
Registered: Mar, 2002

Re: Help!!!! Posted: Mar 27, 2002 3:09 PM
Reply to this message Reply
Thanks for the reply, I gave what you sugested a try but it didn't work, however I did get it to work by doing the following

public void deleteFromBook(String anISBN)throws SQLException
{
if(canDeleteBook(anISBN))
{
query = "DELETE * FROM book WHERE isbn ='" + anISBN+"'";
statement.executeUpdate(query);
statement.executeUpdate(query);
}
}

I don't know why this works but it does, do you have any ideas?

Flat View: This topic has 3 replies on 1 page
Topic: How to position cursor in JFileChooser Previous Topic   Next Topic Topic: multiuser programming in java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use