INSERT 数据后数据表没有及时刷新,怎么更新? 项目中用到数据库,对数据库不是很了解,现在用mysql数据库,向其中插入数据,然后通过数据浏览器查看表,发现并没有及时更新,怎么解决? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是如何插入数据的? 事务是否打开了? 有没有进行提交 commit; 直接在sql编辑器中写sql语句的如INSERT into table_currentday(cityID, cityName, date_Solar, date_Lunar, weather, temperature, wind)VALUES(123456, '','', '','', '','') 还有个问题,关于sql语句的先贴上部分代码 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(); } }%'和'%到底该怎么用?我的这个sql语句老是报错,请高手看看该怎么改,谢谢了! 同ip 和同设备只算一条记录。。求有多少条记录?sql语句写出来。 mysql正则相关 mysql的c api的一个问题? 通过附加层访问mysql 这个替换语句怎么写? postgres SQL的使用问题 一个简单的sql语句 --------------------select 问题————————————————?? mysql日期问题 mysql 变量当表名 关于MySql配置my.ini的疑问 mysql中如何对2个表查询?
如INSERT into table_currentday(cityID, cityName, date_Solar, date_Lunar, weather, temperature, wind)
VALUES(123456, '','', '','', '','')
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();
}
}
%'和'%到底该怎么用?我的这个sql语句老是报错,请高手看看该怎么改,谢谢了!