相关文章
更多最近更新
更多mysql问题
2019-03-25 13:33|来源: 网路
利用PreparedStatement执行插入,更新的操作时候:
如:
PreparedStatement pstmt=....
String update = "update mytable set studentId=?,politics=?,minzu=?,dormAddress=?,dormPhone=?,email=?,
phoneNumber=?,homeAddress=?,post=?,homePhone=?,from=?,others=? where name=?";
pstmt.setString(1,name);
...;
出现MySQLSyntaxErrorException
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 'from='from', others=null where name= "ok"'
当我去掉update语句后面的from=?,others=?时候,此时能够正常执行更新操作,这是什么原因呢?
我用的mysql的版本是5.5
如:
PreparedStatement pstmt=....
String update = "update mytable set studentId=?,politics=?,minzu=?,dormAddress=?,dormPhone=?,email=?,
phoneNumber=?,homeAddress=?,post=?,homePhone=?,from=?,others=? where name=?";
pstmt.setString(1,name);
...;
出现MySQLSyntaxErrorException
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 'from='from', others=null where name= "ok"'
当我去掉update语句后面的from=?,others=?时候,此时能够正常执行更新操作,这是什么原因呢?
我用的mysql的版本是5.5
相关问答
更多-
mysql 怎么用[2022-01-03]
不会用mysql gui tools ,你就用下sqlyog ,自己到网上下载个破解版的就OK了,链接的时候,host填入localhost,username填入你安装时候设置的用户名,一般是root,password填入安装时候设置的密码,这个你自己应该知道,点击connect就可以了,进入就自己看看吧,跟sql server的企业管理器对比起来,这个应该是简单多了 -
关于MYSQL的问题[2024-01-01]
SQL语言,数据库基础电子资料: SQL语法大全中文版 http://bbs.topsage.com/dispbbs.asp?boardID=122&ID=148128 SQL语言案头完全参考手册 http://bbs.topsage.com/dispbbs.asp?boardID=122&ID=146159 SQL - A Practical Introduction http://bbs.topsage.com/dispbbs.asp?boardID=122&ID=148095 O'Reilly SQL ... -
还有个问题关于 MYSQL[2020-11-06]
如果是要发布到互联网的话 你肯定要购买 , 至于安装教程么: http://www.webisok.com/viewthread.php?tid=202&highlight=mysql看这个 -
遇到一个mysql问题[2023-07-09]
rs=pst.executeQuery(sql); 不需要sql吧! 只需要rs=pst.executeQuery(); 因为pst=con.prepareStatement(sql); prepareStatement已经预处理sql了, 如果con.prepareStatement(sql) 重置了sql ?没有赋值! -
mysql怎么启动?怎么进入控制台?[2022-05-29]
ubuntu: sudo start mysql 其他: /etc/init.d/mysql start -
mysql怎么启动?怎么进入控制台?[2023-04-03]
你的系统是Linux还是windows的?linux就查看my.cnf,windows就查看my.ini,里面有一项设置 下面是我的my.cnf里面的 1 [client] 2 #password = your_password 3 port = 3306 4 socket = /tmp/mysql.sock 查看你/tmp下有没有mysql.sock 然后再启动你的mysql /usr/local/mysql/bin/mysqld_safe --user=mysql & -
mysql如何使用[2021-12-02]
一般都用第三方管理软件,比如MySQL Tools for 5.0 你要是想在控制台连接数据库的话,设置一下环境变量就随便打开个控制台就能访问了。 将MySQL安装目录的bin目录设置到环境变量Path中,比如:"C:\Program Files\MySQL\MySQL Server 5.0\bin" 然后在控制台中按格式输入信息就可以对数据库进行操作了。 格式:mysql --user=用户名 --password=密码 [数据库名] -
MYSQL的特点是什么?[2023-04-15]
mysql是一个可用于各种流行的操作系统平台的关系数据库系统(关系数据库RDBMS是许多环境中的一个基本的工具,从商务,研究和教育环境中的许多传统应用程序到诸如互联网上的搜索引擎这样的应用程序都要使用关系数据库)他具有客户机/服务器体系结构的分布式数据库关系提供。 网站:http://www.skyhosting.com.cn -
mysql特点[2023-09-16]
小巧精致,开源(一般免费),而不失完整的一款关系型数据库系统。 -
有什么数据库专业书籍介绍?[2022-05-19]
mysql