Java program help required.

U

umashd

Hi

I am beginner doing a project for my graduation. The simple code I
developed makes me go crazy. Problemaic code is below.

ResultSetMetaData rsmd = rs.getMetaData();
int columnCount=rsmd.getColumnCount();
while ( rs.next() )
{
out.println("<BR>Check point Row No : " + rs.getRow() );
for (int i=1; i<=columnCount; i++)
{
String cValue=rs.getString(i);
out.println("<BR> Column Value =" +cValue );
if (cValue.equalsIgnoreCase(searchString))
{
out.println("<BR><B> Record Found. Row:" +rs.getRow() +"</B>");
}
}
}

Basically, I get the ResultSet from the database and search for a
string searchString in all column values. It works fine but only one
itration. ie the while loop terminates after the first itration. When I
remove the if condition, or change the condition with litrals (if ("z"
== "z")...) it works. I do not know what is worng with the code or my
logic. Can any one help me?

Uma
 
A

Andrew Thompson

Basically, I get the ResultSet from the database and search for a
string searchString in all column values. It works fine but only one
itration.

How many rows are in the data? (That is something
we cannot see from here)
..ie the while loop terminates after the first itration.

What do you mean 'terminates'?

If there is only one row, that is entirely logical.
If, on the other hand, there are 2 or more, it is not.

Can you get a list of textual data (equivalent to the
data in the result set) to print from start to finish?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top