java web中使用mysql语句遇到的问题

 

1、插入数据时遇到     Parameter index out of range (1 > number of parameters, which is 0).  的问题

有问题的代码:

 

改为如下:

 

即可,但是?必须时英文情况下输入。

 

创建表遇到问题:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL UNIQUE AUTO_INCREMENT,\

错误语句:

mysql> CREATE TABLE userinfo(
-> id IBIGINT(20) AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
-> name varchar(100) COMMENT 'name',
-> varchar(6) NOT NULL COMMENT 'password'
-> );

 

更改为:

mysql> CREATE TABLE userinfo(
-> `id`BIGINT(20) AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
-> `name`varchar(100) COMMENT 'name',
-> `password` varchar(6) NOT NULL COMMENT 'password'
-> );

后运行成功:

原因:

参考文档:http://blog.csdn.net/jdjdndhj/article/details/70242174

 

posted @ 2018-03-09 16:27  你好and程序员  阅读(170)  评论(0编辑  收藏  举报