在數碼化工廠的系統中需要傳遞陣列引數,返回還能使用,參考如下
procedure tform1.procnormal(value: string);
begin
orignum:=value+' me';
lblreturn.caption:=orignum;//orignum為'hello me'
lblorig.caption:=value;//value為'hello'
end;
呼叫:
orignum:='hello';
procnormal(orignum);
procedure tform1.procconst(const value: string);
begin
orignum:=value+' me';
lblreturn.caption:=orignum;//為'hello me『
lblorig.caption:=value;//為'hello me'
end;
procedure tform1.procref(var value: string);
begin
orignum:=value+' me';
lblreturn.caption:=orignum;//為'hello me『
lblorig.caption:=value;//為'hello me'
end;
procedure tform1.procout(out value: string);
begin
orignum:=value+' me';
lblreturn.caption:=orignum;//為'me'
lblorig.caption:=value;//為'me'
end;
procedure tform1.procuntype(const value);
begin
orignum:=string(value)+' me';
lblreturn.caption:=orignum;//為'hello me'
lblorig.caption:=string(value);//為'hello me'
end;
procedure tform1.procdefault(const value, const defaultvalue:string=' 123');
begin
orignum:=value+' me'+defaultvalue;
lblreturn.caption:=orignum;//為'hello me 123'
lblorig.caption:=value;// 為'hello me 123'
end;
procedure tform1.procarray(const value: array of string);
var
i:integer;
begin
for i:=low(value) to high(value) do
orignum:=orignum+value[i];//呼叫後為'hello abc dbd'
lblreturn.caption:=orignum;
end;
呼叫:
orignum:='hello';
procarray([' abc ',' dbd']);
procedure tform1.procarrayconst(const value: array of const);
var
i:integer;
begin
for i:=low(value) to high(value) do
with value[i] do
case vtype of
vtansistring: orignum:= orignum+string(vansistring);
vtinteger: orignum:=orignum+inttostr(vinteger);
vtboolean: orignum := orignum + booltostr(vboolean);
vtchar: orignum := orignum + vchar;
vtextended: orignum := orignum + floattostr(vextended^);
vtstring: orignum := orignum + vstring^;
vtpchar: orignum := orignum + vpchar;
vtobject: orignum := orignum + vobject.classname;
vtclass: orignum := orignum + vclass.classname;
vtcurrency: orignum := orignum + currtostr(vcurrency^);
vtvariant: orignum := orignum + string(vvariant^);
vtint64: orignum := orignum + inttostr(vint64^);
end;
lblreturn.caption:=orignum;//呼叫後為'hello abc 3'
end;
呼叫:
orignum:='hello';
procarrayconst([' abc ',3]);
以上就是常見幾種傳遞引數的方式。
函式傳空參 呼叫儲存過程
這個可是折騰了我昨天一下午,我就是喜歡能少寫方法就少寫,所以就會出現很多的問題。不過還是有很多收穫。算了,還是貼 吧,看的實在點。int?companyid convert.toint32 session frame id 這個是aspx.cs檔案定義的引數咯,當session frame id 為...
mysql匯入匯出包括函式或者儲存過程
1.mysql匯出整個 資料庫mysqldump h hostname u username p databasename backupfile.sql 如果root使用者沒用密碼可以不寫 p,當然匯出的sql檔案你可以制定乙個路徑,未指定則存放在mysql的bin目錄下 www.2cto.com ...
main函式傳引數以及執行過程
需求 通過main函式傳遞引數,輸入若干個字串,並進行列印輸出。分析 main函式包括兩個引數,main函式的原型為 void main int argc,char argv argc代表了引數的個數,argv代表了每個字串的首位址。我們可以進行如下程式的編寫 void main int argc,...