日期:2014-05-18  浏览次数:20782 次

一个简单问题,却没解决!
我用的ASP.NET C#
今天调试程序,报错为:
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 'MySqlSecond')' at line 1

这个是说我的数据库语句有错了!
我单步调,把数据库语句拿出来为:
Update GroupInfo set MatchVolume = 'D:\\' where Groupid = (select Groupid from `Group` where GroupName = 'MySqlSecond')
到MySql命令行和MySqlFront下去运行却均正常!
我完全不知道在 ASP.NET下,为什么报错,而且说错误在最后的 “MySqlSecond')”!完全看不出来哪儿有错!难道和C#的其他什么想冲突了?

------解决方案--------------------
为什么回了没有显示呢?
------解决方案--------------------
Update GroupInfo set MatchVolume = 'D:\\' where Groupid = (select Groupid from Group where GroupName = 'MySqlSecond') 

from 后面的table不要加''
------解决方案--------------------
Update GroupInfo set MatchVolume = 'D:\\' where Groupid = (select Groupid from Group where GroupName = 'MySqlSecond') 

在mssql是 用 in
Update GroupInfo set MatchVolume = 'D:\\' where Groupid in (select Groupid from Group where GroupName = 'MySqlSecond') 

mysql我不知道是不是