String attribute = "age";
String attributesplit= "youth";
Query("select age from cusinfo where class = 'yes' and age = 'youth'"); 得出的结果是正确的。可下面的语句 运行报错 说 Syntax error or access violation, message from server: "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 'selectagefrom cusinfo where class = 'yes' and age= 'youth'' at "。 Query("select" + attribute + "from cusinfo where class = 'yes' and " + attribute + "= '"+ attributesplit +"'");
不知道问题出在哪?有知道的请帮忙解决一下。
String attributesplit= "youth";
Query("select age from cusinfo where class = 'yes' and age = 'youth'"); 得出的结果是正确的。可下面的语句 运行报错 说 Syntax error or access violation, message from server: "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 'selectagefrom cusinfo where class = 'yes' and age= 'youth'' at "。 Query("select" + attribute + "from cusinfo where class = 'yes' and " + attribute + "= '"+ attributesplit +"'");
不知道问题出在哪?有知道的请帮忙解决一下。
比如"select" + attribute 结果是selectage 谁也不认得这是什么了。
呵呵,给你个建议,把生成的sql打出来看看就知道了,呵呵
同情,我也经常粗心……
到了没有办法的地步才仔细研究。