求大神给个注释~~ package com.mypro.dao; import java.sql.Connection; import java.sql
求大神给个注释~~packagecom.mypro.dao;importjava.sql.Connection;importjava.sql.PreparedStatem...
求大神给个注释~~
package com.mypro.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.mypro.bean.Timebook;
public class TimeBookDAO {
public static boolean insertTime(Timebook t){
boolean flag = false;
Connection conn = DBUtil.getConnection();
PreparedStatement pst = null;
String sql = "insert into timebook values (?,?,?)";
try{
pst = conn.prepareStatement(sql);
pst.setString(1, t.getSignTime());
pst.setString(2, t.getSlgnlype());
pst.setInt(3, t.getStuinfold());
int count = pst.executeUpdate();
if(count > 0){
flag = true;
}
}catch(SQLException e){
e.printStackTrace();
}finally{
DBUtil.closeAll(null, pst, conn);
}
return flag;
}
} 展开
package com.mypro.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.mypro.bean.Timebook;
public class TimeBookDAO {
public static boolean insertTime(Timebook t){
boolean flag = false;
Connection conn = DBUtil.getConnection();
PreparedStatement pst = null;
String sql = "insert into timebook values (?,?,?)";
try{
pst = conn.prepareStatement(sql);
pst.setString(1, t.getSignTime());
pst.setString(2, t.getSlgnlype());
pst.setInt(3, t.getStuinfold());
int count = pst.executeUpdate();
if(count > 0){
flag = true;
}
}catch(SQLException e){
e.printStackTrace();
}finally{
DBUtil.closeAll(null, pst, conn);
}
return flag;
}
} 展开
2017-05-22 · 做品质教育,用事实说话
关注
展开全部
就是插入了一条TimeBook记录,DBUtil是它自己编写的一个注册数据库驱动,及连接数据库的类,还需要咋注释啊
追问
额...好吧
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询