Wednesday, August 31, 2011

input something

public void addStudent(Student s) {
PreparedStatement pst = null;
String query = "insert into student values (?,?,?)";

try{
pst= (PreparedStatement) con.prepareStatement(query);
pst.setInt(1, s.getsId());
pst.setString(2, s.getsName());
pst.setInt(3, s.getDepId());

pst.execute();
}catch(Exception e){
System.out.println(e);
}
}

No comments:

Post a Comment