今天將資料寫入資料庫 可是顯示資料庫中表不存在。
代碼為
String tableName = request.getParameter("tableName");//資料庫表名
String excelname = request.getParameter("ExcelName");//需匯入的excel檔案名
String TABLE_NAME = tableName;//資料庫表名
String PATH = "E:\\礦山檢測\\matlab礦山地壓實時監測與災害預警系統V2.38.200616\\data\\";//檔案路徑
String EXCEL_PATH = PATH+ excelname;//excel路徑
String INSERT_SQL ="insert into" +TABLE_NAME +
"(no, date, time, days,value1,direction1,dip1,value2,direction2,dip2,value3,direction3,dip3,StressDifference,remark)" +
" values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
String UPDATE_SQL = "update " +
TABLE_NAME +
"no=?, date=?, time=?, days=?,value1=?,direction1=?,dip1=?,value2=?,direction2=?,dip2=?,value3=?," +
"direction3=?,dip3=?,StressDifference=?,remark=? where id = ? ";
String SELECT_ALL_SQL ="select id, no, date, time, days,value1,direction1,dip1,value2,direction2,dip2,value3,direction3,dip3,StressDifference,remark from "+TABLE_NAME;
String SELECT_SQL = "select * from "+TABLE_NAME+" where time like";傳遞來的資料庫表名為y001,但是顯示錯誤,錯誤代碼部分如下

資料庫中y001表是存在的,請問這是為什么????
uj5u.com熱心網友回復:
String INSERT_SQL ="insert into" +TABLE_NAME +缺少空格 導致into 和庫名連在一起
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/152966.html
標籤:Java EE
上一篇:出大事了,專案內容全不見了
