//rdmStudy
procedure TrdmUserStudy.SubmitResult(const vUserID:WideString;const vTestType: WideString; vResult: Single; var vRe: OleVariant);
begin
  //增添考试记录
  qryMain.Close;
  qryMain.SQL.Add('INSERT INTO testDetail');
  qryMain.SQL.Add('(userName , testType , correctRate) VALUES');
  qryMain.SQL.Add('(:pUserID , :pSubject , :pResult)');
  qryMain.Parameters.ParamValues['pUserID'] := vUserID;
  qryMain.Parameters.ParamValues['pSubject'] := vTestType;
  qryMain.Parameters.ParamValues['pResult'] := vResult;
  if qryMain.Prepared = False then
  begin
    qryMain.Prepared := True;
  end;
  qryMain.ExecSQL;
  qryMain.Close;
  qryMain.SQL.Clear;
  qryMain.SQL.Add('SELECT rematkContent FROM re');
  qryMain.SQL.Add('WHERE reNumber = :pSubject') ;
  if vResult < 0.6 then
  begin
    qryMain.Parameters.ParamValues['pSubject'] := '1' ;
  end
  else if (vResult >= 0.6) and (vResult < 0.7) then
  begin
    qryMain.Parameters.ParamValues['pSubject'] := '2' ;
  end
  else if (vResult >= 0.7) and (vResult < 0.8) then
  begin
    qryMain.Parameters.ParamValues['pSubject'] := '3';
  end
  else if (vResult >= 0.8) and (vResult < 0.9) then
  begin
    qryMain.Parameters.ParamValues['pSubject'] := '4';
  end
  else
  begin
    qryMain.Parameters.ParamValues['pSubject'] := '5';
  end;
  if qryMain.Prepared = False then
  begin
    qryMain.Prepared := True;
  end;
  MainForm.Label1.Caption := qryMain.SQL.Text;
  qryMain.Open;
  vRe := Trim(qryMain.FieldByName('rematkContent').AsString);
  qryMain.Close;
end;

解决方案 »

  1.   

    //Client
    procedure TMainForm.btSubmitClick(Sender: TObject);
    var
      Re : Variant;
    begin
      sckStudy.AppServer.SubmitResult(examUser.Text,cbExamType.Text,StrToFloat(examResult.Text),Re);
      showmessage(Re);
    end;end.
      

  2.   

    定义参数一般类型用variant*就很通用了,不要用什么istring,int等等。
    参数的输入输出,一般如果是客户端传给服务器,用[in]
      

  3.   

    1、把客户端的Re改成Olevariant
    2、如果还不行,把你的服务端重新编译,反注册一下,然后重新注册。
      

  4.   

    还发现一个怪现象
    在type library里面删掉一个方法后重新编译工程居然不报错!!!!!!
    为什么???????
      

  5.   

    为什么会报错?服务端没理由报错,客户端你用的是later binding的方式,只有在运行时它找不到服务端的方法才会报错的。
      

  6.   

    可是服务器端程序实现一个已经在远程数据模块中并不存在的method难道不应该报错?
      

  7.   

    在type library里删除method并不会删除实现的单元里对应的method的,你打开你的代码看一下就知道了。