aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes DataInfo getValues() problem- see code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "DataInfo getValues() problem- see code" Watch "DataInfo getValues() problem- see code" New topic

DataInfo getValues() problem- see code

Justin Wong

Joined: Jul 31, 2001
Posts: 17
This piece of code got me stumped for a whole day and I can't figure out why:
public class Project {

public static void main(String[] args) {
try {
Data x = new Data("c:\\temp\\scjd\\starting\\suncertify\\db\\db.db");

DataInfo[] r = x.criteriaFind("Origin airport='SFO',Destination airport='*'");

String [] values = r[1].getValues();
System.out.println(values[8]); // this prints out 22
if (values[8].equals("22"))
System.out.println("not 22");

} catch(DatabaseException ex) {
} catch(IOException ex) {

For some reason, it always prints out "not 22". Any input would be appreciated. Thanks
Matthew Comer
Ranch Hand

Joined: Aug 10, 2001
Posts: 37
The value probably has trailing spaces on it... Remember, this is a PRIMITIVE database - all coluumns are fixed width.
Justin Wong

Joined: Jul 31, 2001
Posts: 17
I just tried it and it works! Thanks a million.
I agree. Here's the link:
subject: DataInfo getValues() problem- see code