Home > Database > Mysql Tutorial > body text

MYSQL语句执行失败,但是无报错_MySQL

WBOY
Release: 2016-06-01 13:12:01
Original
1484 people have browsed it

这两天再弄软件工程的课程设计,遇到一个问题,MYSQL语句一直不能执行,数据库的连接也没有错误,纠结了两天,终于发现错误了,

原代码如下:

try {			String sql = "INSERT INTO<span style="color:#FF0000;"> column</span> (c_title,c_state) VALUES ( '"					+ Column.getC_name()					+ "','"					+ Column.getC_summary()					+ "' )";//			String sql = "insert into column (c_id,c_title,c_state) values (NULL,'abc','def')";			if(dbconn.doUpdate(sql)!=0)				result=true;
Copy after login

直接在MYSQL命令行里调试,发现同样是语句,别的表可以执行,唯独这个表不能执行,终于发现原来是表名的问题,column应该是不能当做表名,重命名表之后在执行,就可以执行成功了。

这个小小的问题折腾了一天,基础还是很重要的==、、

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!