最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

JDBC插入記錄運(yùn)行報(bào)錯(cuò)

JDBC插入記錄運(yùn)行報(bào)錯(cuò)

影色 2016-05-03 16:45:44
String?sql?=?"insert?into?t_user(name,pwd)?values(?,?)";Exception: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 '?,?)' at line 1雖然記錄可以正常添加,但運(yùn)行后就報(bào)錯(cuò)
查看完整描述

1 回答

已采納
?
幽凝

TA貢獻(xiàn)21條經(jīng)驗(yàn) 獲得超8個(gè)贊

說的很清楚,第一行在'?,?)'有語法錯(cuò)誤。

查看完整回答
反對 回復(fù) 2016-05-03
  • 影色
    影色
    語義我當(dāng)然知道,可就是不知道到底哪錯(cuò)了 package shuju; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import model.Emp; import sql.LianJie; public class Add { public static void tj(Emp e) throws SQLException { Connection conn = LianJie.getConnection(); Statement stmt = conn.createStatement(); String sql = " INSERT t_user(name,pwd) values(?,?)"; PreparedStatement ptmt = conn.prepareStatement(sql); ptmt.setString(1, e.getName()); ptmt.setString(2, e.getPwd()); ptmt.execute(); // int c = stmt.executeUpdate(sql); // if (c > 0) { // System.out.println("成功添加數(shù)據(jù)"); // } // if (stmt != null) // stmt.close(); // if (conn != null) // conn.close(); } } 剛把底下判斷操作和關(guān)閉操作注釋掉,就沒報(bào)錯(cuò)了
  • 幽凝
    幽凝
    你上面有into,為什么下面給我的代碼里沒有insert into?
  • 幽凝
    幽凝
    或者這種可能性,你打的兩個(gè)問號編碼不對,漢字的?和英文的?不一樣的。
點(diǎn)擊展開后面3
  • 1 回答
  • 0 關(guān)注
  • 2332 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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