第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

求幫忙找sql語句錯

public void addUser(User u) throws Exception{
?Connection conn=GetConnection.getConnection();
?String sql="insert into user_table (name,sex,keshi,jituanhao,group) values (?,?,?,?,?)";??
?PreparedStatement pdst=conn.prepareStatement(sql);
?pdst.setString(1, u.getName());
?pdst.setString(2, u.getSex());
?pdst.setString(3, u.getKeshi());
?pdst.setInt(4, u.getJituanhao());
?pdst.setString(5, u.getGroup());
?pdst.execute();?
?}
?public void delUser(Integer id) throws SQLException{
??Connection conn=GetConnection.getConnection();
??String sql="" + "delete from user_table" +
????"where id=? ";

??PreparedStatement pdst=conn.prepareStatement(sql);
??pdst.setInt(1, id);
??pdst.execute();
?}
?public void updateUser(User u) throws SQLException{
??Connection conn=GetConnection.getConnection();
??String sql="" + " update user_table"+" set name=?,sex=?,keshi=?,jituanhao=?,group=? " +
????"where id=? ";

??PreparedStatement pdst=conn.prepareStatement(sql);
??pdst.setString(1, u.getName());
??pdst.setString(2, u.getSex());
??pdst.setString(3, u.getKeshi());
??pdst.setInt(4, u.getJituanhao());
??pdst.setString(5, u.getGroup());
??pdst.setInt(6, u.getId());
??pdst.execute();
?}
?public List<User> query() throws Exception{
??Connection conn=GetConnection.getConnection();
??Statement stmt=conn.createStatement();
??ResultSet res=stmt.executeQuery("select name,group ?from user_table");
??List<User> user=new ArrayList<User>();
??User u=null;
??int i=0;
??while(res.next()){
???System.out.println(++i);
???u=new User();
???u.setName(res.getString("name"));
???u.setGroup(res.getString("group"));
???user.add(u);
???
??}
??return user;
?}
?public User get(Integer id) throws SQLException{
??User u=null;
??Connection conn=GetConnection.getConnection();
??String sql="" + "select * from user_table " +
????"where id=? ";??

?pdst=conn.prepareStatement(sql);???
??pdst.setInt(1, id);
??ResultSet rs=pdst.executeQuery();
??while(rs.next()){
???u=new User();
???u.setId(rs.getInt("id"));
???u.setGroup(rs.getString("group"));
???u.setJituanhao(rs.getInt("jituanhao"));
???u.setKeshi(rs.getString("keshi"));
???u.setName(rs.getString("name"));
???u.setSex(rs.getString("sex"));
??}
???
??return u;
?}

增加人員時報錯信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group) values ('??','?','????',6922,'???')' at line 1

刪除人員時報錯信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the?right syntax to use near 'id=23' at line 1

更新人員時報錯信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group='???' where id=24' at line 1

查詢多個人員時報錯信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group from user_table' at line 1

查詢單個人員時報錯信息:/*You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=3' at line 1??PreparedStatement

實(shí)在找不出sql語句錯在哪,在MySQL數(shù)據(jù)庫直接用這些sql語句操作,提示錯誤信息類似。

正在回答

3 回答

字段中間加空格 ? 連在一起是會報錯的

0 回復(fù) 有任何疑惑可以回復(fù)我~

表是用heidiSQL建的

字段是一一對應(yīng)的

關(guān)鍵是直接調(diào)用數(shù)據(jù)庫,輸入sql語句,也是提示有誤

0 回復(fù) 有任何疑惑可以回復(fù)我~

你表是如何創(chuàng)建的?你看看字段什么的一一對應(yīng)嗎?

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消
JDBC之 “ 對岸的女孩看過來”
  • 參與學(xué)習(xí)       99327    人
  • 解答問題       915    個

一起領(lǐng)略JDBC的奧秘,為進(jìn)一步學(xué)習(xí)集成框架打下良好的基礎(chǔ)

進(jìn)入課程

求幫忙找sql語句錯

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號