当前位置: 技术问答>java相关
大侠们救救我啊---jsp检索数据时提示:"无效的描述符索引"
来源: 互联网 发布时间:2015-04-18
本文导语: 用jdbc-odbc桥连库 连mssqlserver2000中文版检索时提示: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引 连sybase11.5检索时提示: java.sql.SQLException: [INTERSOLV][ODBC SQL Server driver]Invalid descriptor index. 代码...
用jdbc-odbc桥连库
连mssqlserver2000中文版检索时提示:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
连sybase11.5检索时提示:
java.sql.SQLException: [INTERSOLV][ODBC SQL Server driver]Invalid descriptor index.
代码如下:
String ls_sql = "select * from XSXXTB"
try
{
Statement Stmt = con.createStatement();
ResultSet rs = Stmt.executeQuery(ls_sql);
if(rs != null)
while (rs.next())
{
li_count++;
out.println("" + rs.getString("XSDD_QDRQ"));
out.println("" + rs.getString("ZWWLDW_DWMC"));
out.println("" + rs.getString("LSWLZD_WLMC"));
out.println("" + rs.getDouble("DDZDJ"));
out.println("" + rs.getString("DDZSL"));
out.println("" + rs.getString("DDZJE"));
out.println("" + rs.getString("DJ"));
out.println("" + rs.getString("SL"));
out.println("" + rs.getString("JE"));
out.println("" + rs.getString("YHKE"));
out.println("" + rs.getString("QK") + "");
out.println("");
}
rs.close();
if(Stmt != null)
Stmt.close();
}
前三个字段类型为char
后面的全部为double
此表无索引
连mssqlserver2000中文版检索时提示:
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
连sybase11.5检索时提示:
java.sql.SQLException: [INTERSOLV][ODBC SQL Server driver]Invalid descriptor index.
代码如下:
String ls_sql = "select * from XSXXTB"
try
{
Statement Stmt = con.createStatement();
ResultSet rs = Stmt.executeQuery(ls_sql);
if(rs != null)
while (rs.next())
{
li_count++;
out.println("" + rs.getString("XSDD_QDRQ"));
out.println("" + rs.getString("ZWWLDW_DWMC"));
out.println("" + rs.getString("LSWLZD_WLMC"));
out.println("" + rs.getDouble("DDZDJ"));
out.println("" + rs.getString("DDZSL"));
out.println("" + rs.getString("DDZJE"));
out.println("" + rs.getString("DJ"));
out.println("" + rs.getString("SL"));
out.println("" + rs.getString("JE"));
out.println("" + rs.getString("YHKE"));
out.println("" + rs.getString("QK") + "");
out.println("");
}
rs.close();
if(Stmt != null)
Stmt.close();
}
前三个字段类型为char
后面的全部为double
此表无索引
|
原因是你检索的字段不是按照数据库字段的顺序写的。
你把它改成数据库字段顺序看一下!