coolgem
asked on
Java: After comparing how to get the record(s) I need?
Hi if the date from an sql while.next is different then Inhow do I get it?
this is what I have so far(up to this point):
while (result.next()) {
String currentDate = result.getString("AUTH_STA RT_DTM");
if (prevStartDate != null) {
int comparison = prevStartDate.compareTo(cu rrentDate) ;
prevStartDate = currentDate;
ReleaseAuth releas = new ReleaseAuth();
releas.setSsn(result.getSt ring("SSN" ));
What do I do after the comparison line?
Thank you
this is what I have so far(up to this point):
while (result.next()) {
String currentDate = result.getString("AUTH_STA
if (prevStartDate != null) {
int comparison = prevStartDate.compareTo(cu
prevStartDate = currentDate;
ReleaseAuth releas = new ReleaseAuth();
releas.setSsn(result.getSt
What do I do after the comparison line?
Thank you
How do you want it compared?
ASKER
If the current date is different from the previous start date then I want to make a new ReleasAuth object and then fill in the other fields obtained from the data base.
I'm confused about that comparison statement where the integer is obtained after the comparison.
Thank you again.
I'm confused about that comparison statement where the integer is obtained after the comparison.
Thank you again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok thank you again cg
:-)
>>I'm confused about that comparison statement where the integer is obtained after the comparison.
That's done per the spec of the Comparable interface:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html#compareTo(T)
>>I'm confused about that comparison statement where the integer is obtained after the comparison.
That's done per the spec of the Comparable interface:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html#compareTo(T)
These links will help you to change it to the same format
http://www.rgagnon.com/javadetails/java-0103.html
http://javaalmanac.com/egs/java.util/CompDates.html
http://www.rgagnon.com/javadetails/java-0103.html
http://javaalmanac.com/egs/java.util/CompDates.html
ASKER
thank you also Kanti