1、向SQL SERVER2000中插入数据,数据库表中id 为int型自增一,
SQL 语句为sqlRst=sqlStmt.executeUpdate("insert into position(logname,position,posdescribe,demand_gender,demand_degree,demand_age,salary,demand_other,quantity,date) values("+logname+","+position+","+posdescribe+","+demand_gender+","+demand_degree+","+demand_age+","+salary+","+demand_other+","+quantity+","+date1+")");
报错为:
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 55 in the jsp file: /biyesheji/company/position_add_ok.jsp
Generated servlet error:
[javac] Compiling 1 source file
D:\tomcat\work\Standalone\localhost\_\biyesheji\company\position_add_ok_jsp.java:115: incompatible types
found : int
required: java.sql.ResultSet
sqlRst=sqlStmt.executeUpdate("insert into position(logname,position,posdescribe,demand_gender,demand_degree,demand_age,salary,demand_other,quantity,date) values("+logname+","+position+","+posdescribe+","+demand_gender+","+demand_degree+","+demand_age+","+salary+","+demand_other+","+quantity+","+date1+")");
2、我想把id的类型由int型变为bigint型,但数据就显示不出来了,是什么原因?
原用int型的可以显示的!
1、update返回int型,你把sqlRst=sqlStmt...的sqlRst去掉。
改成sqlStmt.........就可以了。
问题1, 请注意,,如果是 表 为数字类型的话,插入的数据就不该有,字符型,,需要
问题2 。 jsp/java 中int 的宽度是2~31 。。大约只能对应是宽度是9 的numberic。。如果数字很长,