Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assigning values from ResultSet to objects

 
pramod talekar
Ranch Hand
Posts: 366
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Could you please tell me how to assign values from ResultSet to objects.

Suppose I have an Employee class with a String name as instance variable and setName() setter method.
And I have a table company which has a column named 'EmployeeName'

When ResultSet returns the values.
e.g.
So, how to assign the EmployeeName data to new Employee().name ?
 
Campbell Ritchie
Sheriff
Pie
Posts: 50211
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Isn’t it something like String employeeName = rs.getString(...);
There is a page in the Java Tutorials (about 6 lines down) about result sets.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic