I have had the same problem with MSSQL and in my case I fixed it by getting
the columns from the resultset in the same order as they are declared in the
query.
Best regards
Joakim Olsson
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Liu,
> Leo Huaizhen
> Sent: den 2 januari 2001 08:03
> To: [EMAIL PROTECTED]
> Subject: [SERVLET-INTEREST] Data Type of 'Count(tblUser.status) AS num'?
>
>
> Please help me out.
>
> I have query (SQL Server7.0)
> SELECT Count(tblUsers.status) AS num, username
> FROM tblUsers
> GROUP BY tblUsers.username,tblUsers.status
>
> However, the ResultSet.getInt("num") gave me error:
> javax.servlet.ServletException: [Microsoft][ODBC SQL Server
> Driver]Invalid Descriptor Index
> java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid
> Descriptor Index
>
> I don't know what data type of 'num' should be, and how to fix this error.
> Please help.
> Thanks,
>
> Leo.
>
>
> .....
> while (rs1.next())
> {
> out.println(rs1.getString("username")); //this is
> ok...
> out.println(String.valueOf(rs1.getInt("num")) //error here....
> }
>
> ....
>
> __________________________________________________________________
> _________
> To unsubscribe, send email to [EMAIL PROTECTED] and include
> in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html