• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Fetching Data From Database

 
Ekrem Altintas
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to fetch data from MySQL database.I'm using this statement.



I used sonuc in the code below but compiler is giving error.

[CODE]if (sonuc==0)
{
cumle.executeUpdate("INSERT INTO kelimeler(kelime,sayi) VALUES('"+deger[0]+"',1)");
}[CODE]

I have to use sonuc as integer.Is there method for it?
 
Joe Shy
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ekrem,

The Resultset has get methods for native types like getString(column_number OR "name"). So you could do sonuc.getInt(1); or sonuc.getInt("sayi");. However this depends on your compiler error. If the error has something to do with your query you may want to use the escape sequence \' for ' . Hope this helps.

Joe
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic