提示错误代码如下:
Project ExpertExtract.exe raised exception class EOLeException with message'类型不匹配。'. Process stooped. Use Setp or Run to continue.

解决方案 »

  1.   

    ole/com/com+ 对像参数内容不配啊
      

  2.   

    两边的类型要完全一致。delphi强类型要求
      

  3.   

    楼主boythl,什么意思,我不怎么明白,能说的明白点吗?
      

  4.   

    boythl 的话可以不作考虑, delphi 在调用没有类型文件的 ocx/com 组件时是无类型检查的, 所以可能那位兄弟没看清你把调用代码发上来, 组件有原码就把定义部分发上来, 一看大家都知了, 就是没原码的,对方说明的内容总是有的吧..
      

  5.   

    procedure TfrmExtract1.Button1Click(Sender: TObject);
    var
      sGroupId, sSearch,sReturn :string;
      iOptioncount,IExtracount :integer;
      tempArray1: array of integer;
      i :integer;
    begin  sReturn :='';
      sSearch :='';
      GsSearch :='';  //浏览ExpertGroup表
      ADOTable1.First;
      while not ADOTable1.Eof do
      begin
        SGroupId :=ADOTable1.FieldValues['组ID'];
        IOptioncount :=ADOTable1.FieldValues['总人数'];
        IExtracount :=ADOTable1.FieldValues['抽选人数'];
        if IExtracount <=0 then
        begin
          ADOTable1.Next;
          continue; // 抽选人数为0,则跳出本次循环
        end;    if IExtracount > IOptioncount then
        begin
          Application.MessageBox('抽选人数不能大于总人数, 请重新输入. ', '提示信息', MB_OK);
          exit;
        end;
        //计算出每组选中的专家总人数
        with ADOQuery1 do begin
          Close;
          Connection :=frmMain.ADOConnection1;
          SQL.Clear;
          SQL.Add('select * from Expert where 组ID like :GroupID and 选中= 1 Order by 组ID asc,专家ID asc');
          Parameters.ParamByName('GroupID').Value := SGroupId;      Prepared :=true;
          Open;   //select语句需用Open方法执行
        end;    if IExtracount > ADOQuery1.RecordCount then
        begin
          Application.MessageBox('抽选人数不能大于该组选中的专家总人数, 请重新输入. ', '提示信息', MB_OK);
          exit;
        end;
        setlength(TempArray1,IExtracount);  //根据抽选人数为数组分配内存空间
        //调用抽取函数, ADOQuery1.RecordCount是有效的专家总人数
        sReturn :=ExtractFunc(ADOQuery1.RecordCount,IExtracount,TempArray1);    for i :=low(TempArray1) to high(TempArray1) do
        begin
          ADOQuery1.first;
          ADOQuery1.MoveBy(TempArray1[i]-1);
          //构造查询字符串
          sSearch :=sSearch + ''''+inttostr(ADOQuery1.fieldbyname('专家ID').Value)+''',';
          GsSearch := GsSearch + '专家ID = ' + QuotedStr(ADOQuery1.FieldValues['专家ID']) + ' OR ';
        end;
        ADOTable1.Next;
      end;
      ADOTable1.First;   //完成浏览ExpertGroup表  tempArray1 :=nil;  //释放临时数组内存空间
      if sSearch = '' then //如果没有构造查询字符串,则构造
      begin
        sSearch :='''' + '''';
        GsSearch :='专家ID = ' + QuotedStr('')
      end
      else begin
        sSearch :=copy(sSearch,1,length(sSearch)-1);  //去掉结尾的逗号
        GsSearch :=copy(GsSearch,1,length(GsSearch)-3);  //去掉结尾的OR
      end;
      sSearch := 'select * from Expert where 专家ID in (' + sSearch + ') ' +
        ' Order by 类ID asc,专家ID asc';  with ADOQuery1 do begin
          Close;
          SQL.Clear;
          SQL.Add(sSearch);
          Prepared :=true;
          Open;   //select语句需用Open方法执行
      end;  frmExtract1Rep :=TfrmExtract1Rep.Create(Application);
      button3.Enabled :=true;
      with frmExtract1Rep.ADOTable1 do
      begin
        Close;
        Connection:=frmMain.ADOConnection1;
        TableName:='Expert';  //数据表名称!
        Filtered := False;
        Filter :=GsSearch ;
        Filtered :=true;
        Open;       //打开数据库表
      end;
      DBGrid2.Enabled:=true;
      DBGrid2.Visible :=true;
      DBGrid3.Enabled :=false;
      DBGrid3.Visible :=false;
      Label1.Caption :='抽取结果:';
    end;
    我设置了一下断点跟踪了一下,发现当运行到程序的倒数第八行的Open时,提示了我先前提出的问题的“类型不匹配”。
    应该怎么处理。