String sql="insert into note (id,title,author,content) values (not_sque.nextVal,'?','?','?')";
try {
Connection con=connectionFactory.getconnection();
PreparedStatement ps=con.prepareStatement(sql);
ps.setString(1, note.getTitle());
ps.setString(2, note.getAuthor());
ps.setString(3, note.getContent());values中的not_sque.nextVal是什么意思?
解决方案 »
- linux LAMP 的问题
- 数据库查询变慢
- 为什么我的PostgreSQL的SQL shell(psql)执行不了命令?
- PostgreSQL 与 MySQL 性能大测试(是不是比多了)
- 用sqlyog enterprise 连服务器的数据库,为什么只能连到服务器中的一个库?
- 在开windows防火墙时mysql无法接收到数据问题
- 你们创建mysql数据表的时候一般用什么编码格式?
- 请教一SQL语句
- 求mysql的两张表在用户id等于某个数字,查出两张表的所有信息
- mysql fabric使用split分片出错
- dedecms用mysql,为什么调用FROM_UNIXTIME(postdate)不出来呢?
- mysql能够转换时间吗?_段双晋
这样?
String sql="insert into note (id,title,author,content) values (auto_increment,'?','?','?')";
String sql="insert into note (id,title,author,content) values (null,'?','?','?')";
null就行了,mysql会自动生成自增长的值。
String sql="insert into note (id,title,author,content) values (null,?,?,?)";
http://dev.mysql.com/doc/refman/5.1/zh
insert into talbe_name (id,tietle) values (null,'?')
还有"update note set title=?,author=?,concent=? where id=?";
还是"update note set title='?',author='?',concent='?' where id='?'";
恩,我仔细看下官方文档先,谢谢了 ,我结贴。
insert into talbe_name (id,tietle) values (null,'?') 是标准写法!
下一句是"update note set title='?',author='?',concent='?' where id='?'"; 对!
"update note set title=?,author=?,concent=? where id=?"; 错!