Type mismatch: cannot convert from void to int
来源:百度知道 编辑:UC知道 时间:2024/06/20 14:12:25
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 40 in the jsp file: /zhuce_check.jsp
Type mismatch: cannot convert from void to int
37: <%
38: }else{
39: String sql="insert into cqut_student(Xuehao,Password,Xingming,Xingbie,Age,Address,Tel,Email)values('"+xuehao+"','"+password+"','"+name+"','"+xingbie+"','"+age+"','"+address+"','"+tel+"','"+email+"')";
40: int temp=con.executeUpdate(sql);
41: %>
42:
43:
提示说转换类型错误,但是我的bean中封装public int executeUpdate(String sql){ //数据库更新(修改、插入、删除等)是否成功
int result=0;
try{
con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
result=stmt.executeUpdate(sql);
}catch(SQLException ex){
Sy
An error occurred at line: 40 in the jsp file: /zhuce_check.jsp
Type mismatch: cannot convert from void to int
37: <%
38: }else{
39: String sql="insert into cqut_student(Xuehao,Password,Xingming,Xingbie,Age,Address,Tel,Email)values('"+xuehao+"','"+password+"','"+name+"','"+xingbie+"','"+age+"','"+address+"','"+tel+"','"+email+"')";
40: int temp=con.executeUpdate(sql);
41: %>
42:
43:
提示说转换类型错误,但是我的bean中封装public int executeUpdate(String sql){ //数据库更新(修改、插入、删除等)是否成功
int result=0;
try{
con=DriverManager.getConnection(url,user,password);
Statement stmt=con.createStatement();
result=stmt.executeUpdate(sql);
}catch(SQLException ex){
Sy
Arrays.sort不返回任何东西。它直接修改arr,而不是把修改后的东西返回。
Arrays.sort(arr);
System.out.println("Min:"+arr[0]+"Max"+arr[arr.length-1]);
rs是记录集ResultSet对象,而stmt.executeUpdate()方法则返回所更新的记录条数,为int型,所以出现类型转换错误。建议改成:
int updateNumber=stmt.executeUpdate(condition);
变量名、方法名怎么起不行,为什么那么执著于已经存在的名字呢?
int temp=con.executeUpdate(sql);
你的con是你封装的类创建的对象吗?一般Connection创建的对象才叫这个名,或者叫conn。
executeUpdate?改个别的名不好么,你是想试试想帮你的人的能力还是真想解决些问题?
这应该是编程遇到的问题吧。意思是类型不匹配,不能从void转换成int。
int temp=con.executeUpdate(sql);
改成
stmt.executeUpdate(sql);
编辑C程序时候 type mismatch in redeclaration
ASP数据类型问题?Data type mismatch in criteria expression.
run-time error '13' type mismatch
VB中报错:byref argument type mismatch什么问题啊!
sql语句,浏览器显示“Data type mismatch in criteria expression”
Type mismatch in redeclaration of "f1"
run-time "13" type mismatch 问题
开机出现Run-time error'13': Type mismatch是什么问题?
开机出现Run-time error'13': Type mismatch的警告框怎么办
C语言编程题中报错为“Type mismatch in redeclaration o f 'writeDat" 是哪里的问题.谢谢!!!