嗨,我想插入MySQL數據庫中的值,並附上我的代碼下面,我收到錯誤。下面在MySQL數據庫中插入查詢
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(DB_URL,"root","root");
System.out.println("Remote DB connection established");
PreparedStatement statement=con.prepareStatement("INSERT INTO TBL_MONTHLY_EXPENSES_DETAILS"+
(AVG_COST, RWDS_INCENT,OTH_EXPENSES,TRAVELLING_EXPENSES,CLIENT_VISITS,REV_RECD)VALUES
(AVG_COST, RWDS_INCENT,OTH_EXPENSES,TRAVELLING_EXPENSES,CLIENT_VISITS,REV_RECD);
}catch(Exception e){
System.out.println("Remote DataBase connection establishment error.");
e.printStackTrace();
pn.setProjectName("Failed");
System.out.println(e.getMessage().toString());
}
con.prepareStatement()調用中是否缺少一些引號? – TheWolf
需要查看實際的異常消息以幫助 –
我在查詢中遇到錯誤。 – Numaish