954,604 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to Display A Blank Text Box Instead of Null When a No Record Is In The Database.

Hello Friends!

Want to Post something i know might be very weird but this is how it goes.

In Java we use

RS.getString("FirstName");


to get the value of the column FirstName from the database.

If the valueis not detected then it shows null in the Text Box.

RS.getInt("StudentID");


to get the value of the Column StudentID in integer from the Database.

If the value is not detected then it displays 0.

I want to ask is there a way such that if there is no value then nothing is displayed on the Text Box instead of showing null for string columns and 0 which is showed for integer columns.

All Help Appreciated.

sagar_danceking
Junior Poster in Training
56 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 
String temp = RS.getString("FirstName");

if(temp.isEmpty()){
   out.println("....");
}else{
   out.println("....");
}


I'm a bit rusty, but give it a whack

tyson.crouch
Junior Poster
152 posts since Apr 2010
Reputation Points: 16
Solved Threads: 17
 

hey tyson thanks im gonna be trying the code soon enuf!


Thanks For The Reply :-)

sagar_danceking
Junior Poster in Training
56 posts since Jul 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You