Link to home
Start Free TrialLog in
Avatar of taiping
taiping

asked on

How to do this...??

i have this data as a schema.

Field 1      :    Field 2
A              
A                     Testing 1
A                     Testing 2
A                      
A                      
A                     168

It's blank and not "null". And i am using MS Sql.

When i do this,

while (rs.next()) {
   out.println("rs.getString("Field2"));
   out.println("<BR>");
}

it's print out this;

Testing1
Testing2


168


Where by there is a space in between the testing2 and 168. means it's printing out the blank space as well.
I added this.

while (rs.next()) {
   if (rs.getString("Field2")!=null || rs.getString("Field2")!="") P
   out.println("rs.getString("Field2"));
   out.println("<BR>");
 }
}

but the result is still the same. What happend???
Avatar of taiping
taiping

ASKER

i want to print it as vertical , that's why i put the out.println("<BR>") in. If not, without this line, i can get the filled table field.

:-)
Try:
while (rs.next()) {
   if (rs.getString("Field2")!=null || (rs.getString("Field2")).length()>0) {
   out.println("rs.getString("Field2"));
   out.println("<BR>");
 }
}


Javier
ASKER CERTIFIED SOLUTION
Avatar of jarasa
jarasa
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The problem is that you where putting and .OR. || instead of .AND. &&.

your fisrt code wil probably work too

Javier