首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

很急小女求大家了!

2012-02-16 
很急!!!小女求大家了!!!!!!!在线等!!!!form1.ADOQuery1.SQL.Text: updateinformationsetflgs_grade+(sel

很急!!!小女求大家了!!!!!!!在线等!!!!
form1.ADOQuery1.SQL.Text:= 'update   information   set   flg=   s_grade   +   (select   ID   from   department   where   substring(s_class,3,1)=s_department)   +   right(s_class,1) ';
  form1.ADOQuery1.ExecSQL;

表结构如下:
information:   s_number(key)   s_name   s_grade   s_class   s_tel
department:   id   s_department
提示错误:语法错误,在查询表达式中:s_grade   +   (select   ID   from   department   where   substring(s_class,3,1)=s_department)   +   right(s_class,1)

我在SQL语句在SQL   SERVER中运行的很好!



[解决办法]
首先要保证你SQL在查询分析器中能正确执行
其次你加个括号试试
update information set flg=(s_grade + (select ID from department where substring(s_class,3,1)=s_department) + right(s_class,1))
[解决办法]
update information set flg= s_grade + (select ID from department where substring(s_class,3,1)=s_department) + right(s_class,1)

1. information表中未见有flg字段
2. where substring(s_class,3,1)=s_department 应写为 where substring(information.s_class,3,1)=department.s_department
[解决办法]
可能你更新前没有关闭 ADOQuery1 数据集吧.. ADOQuery1.Close;

热点排行