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语句老是报错,请高手看看该怎么改,谢谢了! mysql排序 mysql 监控工具 mysql 高分求教 MySql 的 BLOB字段读取问题(在线等)?????? 用vc 怎么在mysql 新建一个表,表名是任意一个字符串变量? postgresSQL8.3执行存储函数(自定义函数的命令)是什么? 我想从A表里随机抽取若干条数据,每次抽取的不一样,我该怎么做?请高手帮忙呀!!多谢!!! 在DELPHI中如何使用MYSQL ? 十万火急,关于sqlserver2000的一个简单问题 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语句老是报错,请高手看看该怎么改,谢谢了!