with ADODataSet1 do
    begin
      Close ;
      CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)';
     AdoDataSet1.paramters.parambyname('str').value:=str;
     AdoDataSet1.paramters.parambyname('p').value:=p;
     AdoDataSet1.paramters.parambyname('q').value:=q;
      open;
      Active:=true;
    end;

解决方案 »

  1.   

    CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(' + '''' + str + ''',p,q)';
      

  2.   

    to wbamboo(波波) 
    现在是“参数P没有默认值”to  Drate(小虫) 
         AdoDataSet1.paramters.parambyname('str').value:=str;
         AdoDataSet1.paramters.parambyname('p').value:=p;
         AdoDataSet1.paramters.parambyname('q').value:=q;
    这三条语句编译出错:
    Undeclared identifier:'paramters'
    Missing operator or semicolon
    请问两位,这个问题的原因是什么?
      

  3.   

    我来试试
    var p,q:integer;
        str:string;
    begin  
      str:=Edit1.Text;
      p:=StrToInt(Edit2.Text);
      q:=StrToInt(Edit3.Text);
      with ADODataSet1 do
        begin
          Close ;
          CommandText:=format('insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(''%s'',%d,%d)',[str,p,q]);
          open;
          Active:=true;
        end;
    end;
      

  4.   

    to  micha_he(不会就学)
    Project XX.exe raised exception class EOleException with messge ‘当前提供程序不支持从单一执行返回多个记录集’
      

  5.   

    CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(' + '''' + str + ''',p,q)';
     
    这样写,出错信息为:“参数P没有默认值”
    这是不是就意味着str的问题已解决?如果是的话,那整型变量值的插入应该如何表达?
      

  6.   

    var p,q:integer;
        str:string;
    begin  
      str:=Edit1.Text;
      p:=StrToInt(Edit2.Text);
      q:=StrToInt(Edit3.Text);
      with ADODataSet1 do
        begin
          Close ;
          CommandText:=
    'insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values('''+str+''''+','''+trim(p)+''''+','''+trim(q)+''''+')';
          excute;
          Active:=true;
        end;
    end;
      

  7.   

    刚查了一下,出问题的是Project XX.exe raised exception class EOleException with messge ‘当前提供程序不支持从单一执行返回多个记录集’,实际表里已经追加了一条记录。但提示错误,在ADO组件业下用ADOQUERY组件,错误提示一样,分析好象对表的修改是不正却的,不能实现
      

  8.   

    to  bingjiling(冰激凌), ADODataSet没有.excute方法。
      

  9.   

    把OPEN一句改为EXECSQL,试一试
      

  10.   

    to  micha_he(不会就学) 
    那应该怎么做,用ADOCommand行不行?
      

  11.   

    with ADODataSet1 do
        begin
          Close ;
          CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)';
         AdoDataSet1.paramters.parambyname('str').value:=str;
         AdoDataSet1.paramters.parambyname('p').value:=p;
         AdoDataSet1.paramters.parambyname('q').value:=q;
          EXECSQL;
          Active:=true;
        end;
      

  12.   


         AdoDataSet1.paramters.parambyname('str').value:=str;
         AdoDataSet1.paramters.parambyname('p').value:=p;
         AdoDataSet1.paramters.parambyname('q').value:=q;
    这三条语句编译出错:
    Undeclared identifier:'paramters'
    Missing operator or semicolon
    Undeclared identifier:'EXECSQL'
      

  13.   

    ADODataSet不是也可以执行SQL的吗?
      

  14.   

    用ADOCommand
    open是数据集有返回值的时候使用,Execute是不返回数据集时候使用
    with ADOCommand1 do
        begin
          Close ;
          CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)';
          paramters.ParamValues['str']:=str;
          paramters.ParamValues['p']:=p;
          paramters.ParamValues['q']:=q;
          Execsql;
        end;
      

  15.   

    Undeclared identifier:'paramters'
    Missing operator or semicolon
    Missing operator or semicolon
    Undeclared identifier:'EXECSQL'
      

  16.   

    应该在with ADOCommand1 do前面的语句少了分号
    Execsql应该为Execute
      

  17.   

    问题解决
      with ADOQuery1 do begin
          Close;
          Sql.Clear;
          Sql.Add('insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values(:str,:p,:q)');
          Parameters.ParamByName('str').Value :=str;
          Parameters.ParamByName('p').Value :=p;
          Parameters.ParamByName('q').Value :=q;
          ExecSQL;
      end;多谢各位!
      

  18.   

    再问个问题:如果用ADODataSet,在没有返回值的时候,应该用什么代替open?
      

  19.   

    ADODataSet有ExecSQL方法?我怎么没找到
      

  20.   

    应当是这样:     CommandText:='insert into 作者信息表(作者姓名,知名度指数,业务能力指数)values('+''''+str+''''+','+''''+p+''''+','+''''+q+''''+')';