insertsql :='insert into stringgrid(tpid,10,11,12,13,14,20,21,22,23,24,30,31,32,33,34,40,41,42,43,44,50,51,52,53,54,60,61,62,63,64)
            values ('+''''+trim(currentpatient)+''''+','+
                    ''''+trim(stringgrid1[10])+''''+','+
                    ''''+trim(stringgrid1[11])+''''+','+
                    ''''+trim(stringgrid1[12])+''''+','+
                    ''''+trim(stringgrid1[13])+''''+','+
                    ''''+trim(stringgrid1[14])+''''+','+
                    ''''+trim(stringgrid1[20])+''''+','+
                    ''''+trim(stringgrid1[21])+''''+','+
                    ''''+trim(stringgrid1[22])+''''+','+
                    ''''+trim(stringgrid1[23])+''''+','+
                    ''''+trim(stringgrid1[24])+''''+','+
                    ''''+trim(stringgrid1[30])+''''+','+
                    ''''+trim(stringgrid1[31])+''''+','+
                    ''''+trim(stringgrid1[32])+''''+','+
                    ''''+trim(stringgrid1[33])+''''+','+
                    ''''+trim(stringgrid1[34])+''''+','+
                    ''''+trim(stringgrid1[40])+''''+','+
                    ''''+trim(stringgrid1[41])+''''+','+
                    ''''+trim(stringgrid1[42])+''''+','+
                    ''''+trim(stringgrid1[43])+''''+','+
                    ''''+trim(stringgrid1[44])+''''+','+
                    ''''+trim(stringgrid1[50])+''''+','+
                    ''''+trim(stringgrid1[51])+''''+','+
                    ''''+trim(stringgrid1[52])+''''+','+
                    ''''+trim(stringgrid1[53])+''''+','+
                    ''''+trim(stringgrid1[54])+''''+','+
                    ''''+trim(stringgrid1[60])+''''+','+
                    ''''+trim(stringgrid1[61])+''''+','+
                    ''''+trim(stringgrid1[62])+''''+','+
                    ''''+trim(stringgrid1[63])+''''+','+
                    ''''+trim(stringgrid1[64])+''''+')';
      dm.qrysql.SQL.Clear;
      dm.qrysql.SQL.Add(insertsql);
      dm.qrysql.ExecSQL;调试的时候报错:unterminated string
missing operator  or  semicolon
class does not have  a defanlt  property

解决方案 »

  1.   

    StringGrid1.cells[1,2]少写了个s.而且你的语句可以这样写是不是更好些:
    begin
      with dm.qrysql do
      begin
        close;
        sql.text := 'insert into stringgrid(tpid,10,11,12,13,14,20,21,22,23,24,30,31,32,33,34,40,41,42,43,44,50,51,52,53,54,60,61,62,63,64)'+
                    'values(:tpid,:t1,:t2..........:t64)';
        parameters.ParamByName('tpid').Value := currentpatient;
        parameters.ParamByName('t1').Value := StringGrid1.Cells[1,1];
        parameters.ParamByName('t2').Value := StringGrid1.Cells[1,2];
        ......
        parameters.ParamByName('t64').Value := StringGrid1.Cells[1,64];
        execsql;
      end;
    end;
      

  2.   

    最基本的语法错误,字符串未结束,检查一下字符串吧
    另外,对于引号,不要写",看着都晕,delphi有个函数可以加引号QuotedStr,这样看起来清晰多了