• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Fetching Data From Database

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
A berm makes a great wind break. And we all like to break wind once in a while. Like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic