File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes what will be return type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "what will be return type" Watch "what will be return type" New topic
Author

what will be return type

Arunkumar Chinnadurai
Ranch Hand

Joined: Dec 15, 2011
Posts: 56





IF i execute this query "select sum(workinghours) from signin_signout where empid='tek001' and signindate='2012-04-20' group by empid,signindate" from db
it will return 8 (as sum value)

IF i execute from java rs.getInt("totalworkinghours") returns 0.. Please help what i have done as mistake.

Wendy Gibbons
Bartender

Joined: Oct 21, 2008
Posts: 1107

I know how to fix your problem, and I think i know why

so first the why
in your select you are selecting "sum(workinghours)"

then trying to use the column name "totalworkinghours", well there isn't a column called that in your select. i would expect an exception but it is being nice and returning 0.

the solution: you have 2 options


or
Arunkumar Chinnadurai
Ranch Hand

Joined: Dec 15, 2011
Posts: 56

Sorry guys, i did a small mistake ....now i got clear.

"Without updating working hours values i cannot store working status"

Thanks Friends


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what will be return type