aspose file tools*
The moose likes JDBC and the fly likes If Statement&Equals Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "If Statement&Equals" Watch "If Statement&Equals" New topic
Author

If Statement&Equals

Ekrem Altintas
Greenhorn

Joined: Dec 20, 2005
Posts: 14


I wrote this code. If deger[0] equal to kelime I want to increase the value of sayi.But if block didn't work.What should I do?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41839
    
  63
Some questions that may guide you towards an answer:

- What does "sonuc.first();" accomplish? Can you leave it out?

- What does "if block didn't work" mean? Are any of the if conditions true or false when they shouldn't?

- What is the value of "deger[0]" when it is first used? Has it been initialized?

- Why are deger and kont arrays, if they contain only a single element?


Ping & DNS - my free Android networking tools app
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30516
    
150

Also, don't you want to set kont and not deger in the update statement? deger has remained unchanged so you are setting kelime back to it's original value.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Originally posted by Jeanne Boyarsky:
Also, don't you want to set kont and not deger in the update statement? deger has remained unchanged so you are setting kelime back to it's original value.
I don't see any "update statement". There's an INSERT statement, which creates a new record having sayi=1. That part seems okay to me. But the inner "if" statement doesn't include a SQL UPDATE statement, so the database is not updated. Maybe that is what Ekrem meant by "didn't work".
Akin Demir
Greenhorn

Joined: Jul 08, 2005
Posts: 9
In your kelimeler table is there a column named sayi


-Akin
Akin Demir
Greenhorn

Joined: Jul 08, 2005
Posts: 9
And what if your resultset contained only one row.
You call first() the cursor goes to the firs row then you call next() on rresultset
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: If Statement&Equals