81,094
社区成员
发帖
与我相关
我的任务
分享
public void updataDB(String strTableName,
int strCityID,
String strCityName,
String strDate_Solar,
String strDate_Lunar,
String strWeather,
String strTemperature,
String strWind) {
this.initConnection(); //初始化数据库连接
try {
//声明SQL语句
Statement stmt = conn.createStatement();
String sql = "INSERT into '%" + strTableName + "%'" + "(cityID, cityName, date_Solar, date_Lunar, weather, temperature, wind)"
+ "VALUES( '%" + strCityID + "%','%" +strCityName + "%','%"
+ strDate_Solar + "%','%" + strDate_Lunar + "%','%"
+ strWeather + "%','%" + strTemperature + ",'%"
+ strWind + "%')";
stmt.execute(sql);
} catch(Exception e) {
e.printStackTrace();
} finally {
this.closeConnection();
}
}