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

Assigning values from resultset of db.

 
Accela Moon
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have these (same) errors when trying to retrieve values from a resultset from a db.

Errors:

So, if anyone can tell me wus wrong and how to fix it, I will be real thankful.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You misspelled the variable dbStatement when you tried to create the ResultSet.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there are all sorts of problems here. The first error is pretty clear: the variable "dbStatement" isn't declared anywhere. Most of the rest are pointing out an admirable burst of imagination on your part. Despite how lovely it might be, the java.sql.ResultSet interface does not sport member variables corresponding to each of your column names. You have to call the methods of this interface to access the data. You would probably benefit greatly from reading this tutorial on using JDBC.
There are some other problems, too: local variables (like "validity") can't be declared public; and the class classHistory, not shown here, doesn't have a constructor with an argument list corresponding to the one you've shown here. But those error messages, again, are fairly clear -- you just have to read them.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic