我試圖這樣做:在SQL中使用Java插入Java變量
String sql = "INSERT INTO CURRENT_WEATHER_US VALUES("+city_code+",
"+object.city+","+object.region+","+object.country+","+object.wind_chill+",
"+object.wind_direction+", "+object.wind_speed+","+object.humidity+","+object.visibility+",
"+object.pressure+","+object.rising+",
"+object.sunrise+","+object.sunset+","+object.textual_description+",
"+object.condition_code+","+object.temp+","+object.for_temp_high+",
"+object.for_temp_low+","+object.for_description+","+object.forecast_code+")";
stmt.execute(sql);
錯誤缺少逗號
請幫助
這是在Java中使用SQL語句的最糟糕的方法。請參閱BalusC的正確答案。 – 2010-02-13 05:03:02