Thank you all for the reply to my question.
I tried 'getInt(1)', it doesn't work either.
when i changed the query to

select count(tblUsers.status) as num, tblUsers.username as temp
from tblUsers
group by tblUsers.username, tblUsers.status

getString("temp") works fine, but not getInt("num").
I think it data type problem for sql server. i may
need to convert num to some jdbc specified datatype.

any hint?

thanks,

leo


-----Original Message-----
From: Uday Bhosle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 02, 2001 7:28 AM
To: [EMAIL PROTECTED]
Subject: Re: Data Type of 'Count(tblUser.status) AS num'?


I do not know why it should be a problem you can do two things
first try using
ResultSet.getInt(1) instead of
ResultSet.getInt("num")

second one try your code with other JDBC driver.

Uday Bhosle
B3Web Solutions





"Liu, Leo Huaizhen" <[EMAIL PROTECTED]> on 01/02/2001 01:02:35 AM

Please respond to "A mailing list for discussion about Sun Microsystem's
Java
      Servlet API Technology." <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED]
cc:    (bcc: Uday Bhosle/The Hub Group Inc.)
Subject:  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

___________________________________________________________________________
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

Reply via email to