Note that there are some explanatory texts on larger screens.

plurals
  1. POout parameter and "ShowMessage" function
    primarykey
    data
    text
    <p>I have a function declare like this :</p> <p><code>function execProc(ProcName,InValues:PChar;out OutValues:PChar):integer; //The "OutValues" is a out parameter.</code></p> <p>And I call this function like this:</p> <pre><code>procedure TForm1.Button6Click(Sender: TObject); var v:integer; s:pchar; begin Memo1.Clear; v := execProc(pchar('PROC_TEST'),pchar('aaa'),s); showmessage(inttostr(v)); //mark line Memo1.Lines.Add(strpas(s)); end; </code></pre> <p>when i delete the mark line(showmessage(inttostr(v))),i will have a correct result display in the Memo1,but if i keep use the showmessage(), the memo1 will dispaly an error string : "Messag" ,Why? Thanks for any help!</p> <pre><code>function execProc(ProcName,InValues:PChar;out OutValues:PChar):integer; var str: TStrings; InValue,OutValue: string; i,j,scount: integer; begin Result := -100; i := 0; j := 0; str := TStringList.Create; try sCount := ExtractStrings(['|'], [], InValues, str); with kbmMWClientStoredProc1 do begin Close; Params.Clear; StoredProcName := StrPas(ProcName); FieldDefs.Updated := False; FieldDefs.Update; for i := 0 to Params.Count - 1 do begin if (Params[i].ParamType = ptUnknown) or (Params[i].ParamType = ptInput) or (Params[i].ParamType = ptInputOutput) then begin inc(j); InValue := str[j-1]; Params[i].Value := InValue; end; end; try ExecProc; for i := 0 to Params.Count - 1 do begin if (Params[i].ParamType = ptOutput) or (Params[i].ParamType = ptInputOutput) then OutValue := OutValue + '|' + Params[i].AsString; end; OutValues := PChar(Copy(OutValue,2,Length(OutValue)-1)); Result := 0; except on E:Exception do begin if E.Message = 'Connection lost.' then Result := -101;//服务器连接失败 if E.Message = 'Authorization failed.' then Result := -102;//身份验证失败 Writelog(E.Message); end; end; end; finally str.Free; end; end; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload