File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

exception

 
ashish sood
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

i am writing a simple program of jdbc




however it is generating exception
java.sql.SQLException: No data found..


please help me out with it


 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33691
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Access doesn't let you call getString() twice on the same column. Try changing the code to:

 
sudheer yathagiri kumar
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

str=rs.getString(3); here 3 means 3rd field of the table will be taken

System.out.println(str); by using this to print the value of the column and make close the connection object out side of the while loop.
while()
{

}
rs.close();
s.close();
c.close();

close the statements in reverse order .....

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic