Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checking if a row has been deleted by using resultset

 
khushi shareef
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Iam trying to remove a particular row from my db..
The code is like this:

Now, the problem is when i enter a doctor's name ,it is getting deleted from the db,but suppose if i enter any random name which is not present in the db,then also it is showing as doctor deleted.I think this is because i am not checking the result set..Can somebody suggest me how to do it?
 
Greg Charles
Sheriff
Posts: 3002
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Khushi,

Actually, you're asking a JDBC question, so I'm going to move this over to our JDBC forum. Yes, you're embedding the JDBC code into a JSP, but that doesn't change the nature of the question. Also, please don't embed Java code into JSP.

Have you tried using executeUpdate() instead of executeQuery()? Its return value is the number of rows affected. If that were 0, then you'd know no rows were deleted.
 
khushi shareef
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply charles!
Actually Iam quite new here..so i don't know many of the rules..Sorry for that ..
And Thank you for your suggestion about execute update..I will try using it..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic