回 帖 发 新 帖 刷新版面

主题:Acess 的数据类型问题~~~

我用 access 数据库  
我设置 日期类型  和  数字类型
读取的时候
日期
rs.getDate("xxx");
数字
rs.getInt("xxx");


结果就是

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 327 in the jsp file: /downslook2.jsp

Generated servlet error:
    [javac] Compiling 1 source file

C:\Tomcat 4.1\work\Standalone\localhost\sj\downslook2_jsp.java:509: incompatible types
found   : java.sql.Date
required: java.lang.String
date=rs.getDate("date");


说什么数据类型不相符 ?
这是怎么回事?请大哥们指点

日期  那里我设置了默认值 Now()

回复列表 (共2个回复)

沙发

You have two choices:
1) date=rs.getString("date");
2) Date d = rs.getDate("date");

either one will work.

板凳

非常感谢大哥指点~
第一种方法 不行 
第二种没问题

我来回复

您尚未登录,请登录后再回复。点此登录或注册