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

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

這是怎么回事?

這是怎么回事?

qq_柒分醉_03927370 2016-09-26 21:19:18
??package com.jdbc.dao;import java.sql.Connection;import java.sql.Date;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.util.ArrayList;import java.util.List;import com.jdbc.Jdbc;import com.jdbc.model.Goddess;import com.mysql.fabric.xmlrpc.base.Data;public class GoddessDao {? ? ? ? ?public void addGoddess(Goddess g) throws Exception {? ? ? ? Connection conn = ?Jdbc.getConnection();? ? ? ? String sql =""+"insert ?into imooc_goddess"+"(user_name,sex,age,email,birthday,mobile,"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+"create_user,create_date,update_user,update_date,isdel,)"? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+"values(" + "?,?,?,?,?,?,?,current_date(),?,current_date(),?)";//?相當(dāng)于占位符;? ? ? ? PreparedStatement ?ptmt = ? ?conn.prepareStatement(sql);? ? ? ? ?? ? ? ? ptmt.setString(1, g.getUser_name());? ? ? ? ptmt.setInt(2, g.getSex());? ? ? ? ptmt.setInt(3, g.getAge());? ? ? ? ptmt.setString(4, g.getEmail());? ? ? ? ptmt.setDate(5 , ?new Date(g.getBirthday().getTime()));? ? ? ? ptmt.setString(6, g.getMobile());? ? ? ? ptmt.setString(7, g.getCreate_user());? ? ? ? ptmt.setString(8, g.getUpdate_user());? ? ? ? ptmt.setInt(9, g.getIsdel());? ? ? ? ?? ? ? ? ?? ? ? ? ptmt.execute();? ? ? ? ?? ? ? ? ?? ? ? ? ? ? ? ??? ? ? ? ?} ? ?public void updateGoddess(){ ? ? ? ?} ? ?public void delGoddess(){ ? ? ? ?} ? ?public List<Goddess> query() throws Exception { ? ? Connection conn = ?Jdbc.getConnection(); ? ? Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select ?user_name,age ?from imooc_goddess"); List<Goddess> gs = new ArrayList<Goddess>(); Goddess g = null; while (rs.next()) { g=new Goddess(); g.setUser_name(rs.getString("user_name")); g.setAge(rs.getInt("age")); gs.add(g); } ? ? return gs; ? ?} ? ?public Goddess get(){ ? ? return null; ? ? ? ?}}控制臺(tái)異常:Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 ')values('小夏',1,22,'xiaoxia@qq.com','2016-09-26','13254685481','lee',current_' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.Util.getInstance(Util.java:387) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:942) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1192) at com.jdbc.dao.GoddessDao.addGoddess(GoddessDao.java:35) at com.action.GoddessAction.main(GoddessAction.java:33)
查看完整描述

2 回答

已采納
?
大咪

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

??//SQL語(yǔ)句異常,說(shuō)明寫(xiě)錯(cuò)了
??
?????String?sql?=""+"insert??into?imooc_goddess"+"(user_name,sex,age,email,birthday,mobile,"
???????????????????????????????+"create_user,create_date,update_user,update_date,isdel)"???//這行我覺(jué)得你最后那個(gè)逗號(hào)是多余的
???????????????????????????????+"values("?+?"?,?,?,?,?,?,?,current_date(),?,current_date(),?)";//?相當(dāng)于占位符;


查看完整回答
反對(duì) 回復(fù) 2016-09-26
  • 2 回答
  • 0 關(guān)注
  • 2622 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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