0
if(isource == txtFirstname){
                try{
                   String searchHotelCustomer = "Select * from HotelCustomer where CUSFirstName='"+CUSFirstName+"'";
                   driver.selectQuery(searchHotelCustomer);
                   ResultSet rsSearch = driver.rs;



if(rsSearch.next()){


 txtRoomNum.setText(rsSearch.getString("RoomNumber"));


}


}

how do i get int value from text?

3
Contributors
5
Replies
19
Views
3 Years
Discussion Span
Last Post by Seldar
0

how?
txtRoomNum.setText(rsSearch.Integer.valueOf("RoomNumber"));

0

That's not the question you asked. To get int value from text you can use
int i = Integer.valueOf(text);

Your latest code is trying to convert a String to int then convert that back to String for a setTExt. Why?

0

im trying to get int value from my database.. and then return it to string in textfield

Edited by reincom

0

If I understand you correctly you could do something like the following:

final Sting roomNumberString = "2";
final int roomNumber = Integer.parseInt(roomNumberString);

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.