|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
ResultSet problem
Hello,
I have a problem with ResultSet. Here's a part of my code : [...] <jsp:useBean id="db" scope="request" class="SQLBean.DbBean" /> <jsp:setProperty name="db" property="*" /> <%@include file="checklogin.jsp"%> <%! ResultSet results = null ; %> [...] results = db.execSQL("SELECT COUNT(*) FROM tbl_question_r WHERE cle_user="+cle_user); [...] execSQL is from DbBean.class, it basically takes a SQL command as an argument. So when the SQL command is sthg like "SELECT * FROM table_name", all i have to do is results.getString("name_of_db_column") However in this case, SELECT COUNT(*) FROM is a number. How can i get it? results.getString(0) doesn't work it seem. Any help would be great ![]() Remy |
|
#2
|
|||
|
|||
|
use getString(1).
|
|
#3
|
|||
|
|||
|
i did so, but now i have this error :
org.apache.jasper.JasperException: Before start of result set ![]() any guess? |
|
#4
|
|||
|
|||
|
if that can help, the bare code is basically :
Last edited by remy : August 5th, 2003 at 09:19 AM. |
|
#5
|
|||
|
|||
|
stupid me i'm lacking the if result1.next() ... else exception.
now it works. thanks. |
|
#6
|
|||
|
|||
|
you could also use getInt(), 'cause you have a numeric value.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > ResultSet problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|