int范围是-65536到65535,所以8位的一定要用long了java.sql.ResultSetgetLong
public long getLong(int columnIndex)
throws SQLExceptionRetrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language. Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
public long getLong(int columnIndex)
throws SQLExceptionRetrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language. Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
public long getLong(int columnIndex)
throws SQLExceptionRetrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language. Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs--------------------------------------------------------------------------------getFloat
public float getFloat(int columnIndex)
throws SQLExceptionRetrieves the value of the designated column in the current row of this ResultSet object as a float in the Java programming language. Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the value returned is 0
Throws:
SQLException - if a database access error occurs
方法是有的,是不是你数据库里的字段不是数字形的?好好看看
javax.servlet.ServletException: hp.Hr.getEID()F
这是怎么回事呢?
请高手指点一下,多谢了!
怎么能用long呢?
这样就应该用double了
或者getBigDecimal()再不行就將數據庫裡面的改為varchar(8)不就行啦﹐ 折衷的辦法﹗
工号又不用于计算,就算要计算,在把它转成long也行啊。
在你取这些工号的时候你把这些工号当成是汉字来处理就行了这样就可以显示全了