what is return type of ResultSet interface

hi all,

I am new to java technology sir and here i am facing some problem with ResultSet interface. In my program i am fetching the data from the available tables in the database.

Initially i am using loigin page in my page i have one text field whenever we open the login.jsp page it will ask cust_id and have to click on submit button then the action is going to next page i.e, succes.jsp in that page i am displaying the firstname,lastname,dob.

In success.jsp i am executing below statement

i.e, ResultSet rs = stmt.executeQuery ("select c.cust_id,cust_firstname,cust_lastname,cust_dob from customer c where cust_id='"+cid+"' ");

Here my intention is to display customer details based on that we have entered in login.jsp file if the id is matched only. If not have any record with the cust_id then have to display some error message.

[926 byte] By [sum2005a] at [2007-10-2 8:00:11]
# 1

Assuming that the result set will have either 1 row or zero rows the following will work.

//attempt to move to the first row of the result set

if(rs.next()){

//found customer print out data

}else{

// no rows found! print customer not found error message

}

sum2005a at 2007-7-16 21:51:52 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
if used like as u said it is checking only for first record. It was not goingto second record.....
sum2005a at 2007-7-16 21:51:52 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
> if used like as u said it is checking only for first> record. It was not going> to second record.....Sorry that was not clear that you would have that. Well a do{ }while loop would serve you well inside the if block.
sum2005a at 2007-7-16 21:51:52 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...