With SQLQuery1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('Insert into rj values (:tian,:notes,:default)');       //51句
    Parameters.ParamByName('tian').Value := DateTimePicker1.Date;   //52句
    Parameters.ParamByName('notes').Value := RichEdit1.Text;
    ExecSQL;
  end;
[Error] Unit1.pas(51): Object or class type required
[Error] Unit1.pas(51): Missing operator or semicolon
[Error] Unit1.pas(52): Object or class type required
[Error] Unit1.pas(52): Missing operator or semicolon

解决方案 »

  1.   

        Close;
        SQL.Clear;
        SQL.Add('Insert into rj values (:tian,:notes,:default)');      //51句
        ParamByName('tian').Value := DateTimePicker1.Date;  //52句
        ParamByName('notes').Value := RichEdit1.Text;
        ExecSQL;
      

  2.   

    第3个字段缺省,不赋值。
    With SQLQuery1 do 
      begin 
        Close; 
        SQL.Clear; 
        SQL.Add('Insert into rj values (:tian,:notes,:default)');      
        Parameters.ParamByName('tian').Value := DateTimePicker1.Date;  //51句 
        Parameters.ParamByName('notes').Value := RichEdit1.Text; 
        ExecSQL;  //52句 
      end; 
    [Error] Unit1.pas(51): Object or class type required 
    [Error] Unit1.pas(51): Missing operator or semicolon 
    [Error] Unit1.pas(52): Object or class type required 
    [Error] Unit1.pas(52): Missing operator or semicolon
      

  3.   

    第3个字段缺省,不赋值。 
    With SQLQuery1 do 
      begin 
        Close; 
        SQL.Clear; 
        SQL.Add('Insert into rj values (:tian,:notes,:default)');      
        Parameters.ParamByName('tian').Value := DateTimePicker1.Date;  //51句 
        Parameters.ParamByName('notes').Value := RichEdit1.Text; //52句
        ExecSQL;   
      end; 
    [Error] Unit1.pas(51): Object or class type required 
    [Error] Unit1.pas(51): Missing operator or semicolon 
    [Error] Unit1.pas(52): Object or class type required 
    [Error] Unit1.pas(52): Missing operator or semicolon
      

  4.   

    DateTimePicker1,RichEdit1
    这两个控件有吗?
      

  5.   


      SQLQuery1.Params.ParamByName()
      SQLQuery1.ParamByName()你看看SQLQuery1后面根本就没有Parameters这个属性:(
      

  6.   

    Close; 
        SQL.Clear; 
        SQL.Add('Insert into rj values (:tian,:notes,:default)');      
        ParamByName('tian').Value := DateTimePicker1.Date;   
        ParamByName('notes').Value := RichEdit1.Text; 
        ExecSQL; 
    这样改后编译通过。