在JAVA与SQL连接中,如何将string类型转换为char类型
publicstaticvoidinsert(Stringemname,charemsex,Stringemdept,Stringemtel){Connectioncon...
public static void insert(String emname, char emsex,String emdept,String emtel) {
Connection con = null;
PreparedStatement s = null;
con = DbControl.connect();
try {
s = con.prepareStatement(
"insert employeeData (employeeName,sex,dept,tel) select ?,?,?,?");
s.setString(1,emname);
s.此处如何写(2,emsex);
s.setString(3,emdept);
s.setString(4,emtel);
s.execute();
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
DbControl.close(s, con);
}
} 展开
Connection con = null;
PreparedStatement s = null;
con = DbControl.connect();
try {
s = con.prepareStatement(
"insert employeeData (employeeName,sex,dept,tel) select ?,?,?,?");
s.setString(1,emname);
s.此处如何写(2,emsex);
s.setString(3,emdept);
s.setString(4,emtel);
s.execute();
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
DbControl.close(s, con);
}
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |