cool, it works, thanks, bhushan.
leo

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


Hi

I am sure it is a problem of the driver which you are using. There is no
problem in the code. But the driver should support what you are trying to do
here. Let me tell you what is that ----

SELECT Count(tblUsers.status) AS num, username FROM tblUsers GROUP BY
tblUsers.username, tblUsers.status

while (rs1.next())
{
  out.println(rs1.getString("username"));                       //this is
ok...
  out.println(String.valueOf(rs1.getInt("num"))         //error here....
}

in your code you are trying to extract the username first and then num,
while in query you have specified num first and then username. Old versions
of drivers doesn't support this. Try this it will work for your
driver.......

while (rs1.next())
{
  out.println(String.valueOf(rs1.getInt("num"));
  out.println(rs1.getString("username"))
}

javax.servlet.ServletException: [Microsoft][ODBC SQL Server
Driver]Invalid Descriptor Index
        java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Invalid
Descriptor Index

The error which you got clearly says "Invalid Descriptor Index"

Thanks & Regards
Bhushan Bhangale
http://www.bbhangale.com

                    "Liu, Leo Huaizhen"
                    <Leo.Liu@COMMERCEONE.        To:
[EMAIL PROTECTED]
                    COM>                         cc:
                    Sent by: "A mailing          Subject:     Data Type of
'Count(tblUser.status) AS num'?
                    list for discussion
                    about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."
                    <SERVLET-INTEREST@jav
                    a.sun.com>


                    01/02/01 12:32 PM
                    Please respond to "A
                    mailing list for
                    discussion about Sun
                    Microsystem's Java
                    Servlet API
                    Technology."





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....
}

Chequemail.com - a free web based e-mail service that also pays!!!
http://www.chequemail.com

___________________________________________________________________________
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