SQLCode := ' set rowcount 0 select a.department,a.department_name,b.staff_name,b.staff_id,c.staff_id,c.department,d.*'
               + ' from run..department a,run..staff_base_infor b,run..staff_dy c,run..staff_contract d '
               + ' where department_name = '+ '''' + trim(sCmbBdepart.Text) + ''''
               + ' and a.department=strtoint(ssgstaff.Cells[1,iRow])'//运行时这里提示在第1行:i,iRow附近有语法错误,ssgstaff.Cells[1,iRow] 是在stringgrid中取当前选中的行的值;
                              + ' and b.staff_id=c.staff_id'
               + ' and d.staff_id=c.staff_id';

解决方案 »

  1.   

    strtoint是delphi的语法不是sql的。用convert。用法参考sqlserver的帮助。
      

  2.   

    strtoint是delphi的语法不是sql的。用convert。
      

  3.   

    SQLCode := ' set rowcount 0 select
                     a.department,a.department_name,
                     b.staff_name,b.staff_id,
                     c.staff_id,c.department,d.*'
                + ' from run..department a,
                         run..staff_base_infor b,
                         run..staff_dy c,
                         run..staff_contract d '
                + ' where department_name = '
                + '''' + trim(sCmbBdepart.Text) + ''''
                + ' and a.department='
                +''''+ strtoint(ssgstaff.Cells[1,iRow])+''''  
                + ' and b.staff_id=c.staff_id'
                + ' and d.staff_id=c.staff_id';
      

  4.   

    madosoft(麦冬尼) ,谢谢!问题解决了!