shilps.java:198: cannot find symbol
symbol : method setDate(int,java.lang.String)
location: interface java.sql.PreparedStatement
ps.setDate(2, "2010-05-31");
^
shilps.java:231: cannot find symbol
symbol : method setDate(int,java.lang.String)
location: interface java.sql.PreparedStatement
ps.setDate(1, "2010-05-31");
^
shilps.java:232: setInt(int,int) in java.sql.Prepared开发者_StackOverflowStatement cannot be applied to
(int,java.lang.String)
ps.setInt(2, "88349");
^
shilps.java:293: e is already defined in main(java.lang.String[])
}catch(Exception e){
^
6 errors
Why the error is occurring? I have included:
import java.util.*;
import java.io.*;
import java.sql.*;
- the 2 param method in
PreparedStatementforsetDatetakes a Calendar, not a String - the 2 param method in
PreparedStatementforsetDatetakes a Calendar, not a String, - the 2 param method for
setInttakes twoints, not and int and a String. - you already have another field in your
mainmethod callede.
The compiler tells you everything you needd to know:
setInt(int,int) in java.sql.PreparedStatement cannot be applied to (int,java.lang.String)
This means, you are passing a Value of Type String to a methods witch needs a int.
The API-Doc of PreparedStatement will show you, that there is a Method setString(int,String) which will take a String as second Parameter.
http://download.oracle.com/javase/1.4.2/docs/api/java/sql/PreparedStatement.html
Maybe you wanted to call ps.setInt(2, 88349);
There ist a valiable called e already defined in that scope.
try{
// some Code
try{
// some more coe
} catch (Exception e){}
^^^
Compiling Error
} catch (Exception e){}
加载中,请稍侯......
精彩评论