Reputation: 716
Dear All,
rs3=st.executeQuery("select * from "+sdata[j]+" where Username='"+idata[i]+"'");
while(rs3.next())
{
%><td><%out.println(rs3.getString("Final_Grade"));%></td><%
}
In the above JSP Code,sdata[j] is the array of table names and idata[i] is the array of usernames. what i am trying to achieve is, to retrieve final_grade from the tables sdata[j] with the username==idata[i] . Since the username is existing in some table it displays the final grade, but when no record found in the table i want print it as "Null" instead of Final_Grade . Is this possible to implement?
Upvotes: 0
Views: 28
Reputation: 1702
Here is an answer based on my most recent comment:
rs3=st.executeQuery("select * from "+sdata[j]+" where Username='"+idata[i]+"'");
flagRows = false;
while(rs3.next())
{
%><td><%out.println(rs3.getString("Final_Grade"));%></td><%
flagRows = true;
}
if (flagRows == false)
{
%><td><%out.println("NULL");%></td><%
}
Upvotes: 1