|
-
Deleting from database - Done so far
Here is the code for what I have done so far
public void removeBank(int bankNo)
{
try
{
myCon = DriverManager.getConnection(myURL,userID,password);
stmt = myCon.createStatement();
rs = stmt.executeQuery("Select * from Banks);
//stmt1 = myCon.createStatement();
rs = stmt1.executeQuery("Delete from Banks where BankNo = " + bankNo);
myCon.close();
}
catch(Exception e)
{
System.err.println(e.toString());
}
}//end method
The way I see it is that I first create a resultset containing the info I
need. Then I delete from that resultset only the specified record, but still
it throws me an exception stating no resultset was created.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks