Parameter.Type 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 參數的類型。
public:
property TypeCode Type { TypeCode get(); void set(TypeCode value); };
public TypeCode Type { get; set; }
member this.Type : TypeCode with get, set
Public Property Type As TypeCode
屬性值
例外狀況
參數類型並非其中的 TypeCode 值。
範例
以下程式碼範例示範如何在使用物件作為輸出參數及回傳值參數時,透過儲存程序設定 DefaultValue物件的 、 Type、 Direction 及屬性 Parameter 。 這個程式碼範例是為類別概述提供 SqlDataSourceStatusEventArgs 的完整範例的一部分。
<asp:sqldatasource
id="SqlDataSource1"
runat="server"
datasourcemode="DataSet"
connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
selectcommand="getordertotal"
onselected="OnSelectedHandler">
<selectparameters>
<asp:querystringparameter name="empId" querystringfield="empId" />
<asp:parameter name="total" type="Int32" direction="Output" defaultvalue="0" />
<asp:parameter name="_ret" type="Int32" direction="ReturnValue" defaultvalue="0" />
</selectparameters>
</asp:sqldatasource>
<asp:sqldatasource
id="SqlDataSource1"
runat="server"
datasourcemode="DataSet"
connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
selectcommand="getordertotal"
onselected="OnSelectedHandler">
<selectparameters>
<asp:querystringparameter name="empId" querystringfield="empId" />
<asp:parameter name="total" type="Int32" direction="Output" defaultvalue="0" />
<asp:parameter name="_ret" type="Int32" direction="ReturnValue" defaultvalue="0" />
</selectparameters>
</asp:sqldatasource>
備註
這個型別可用來建立強型別參數,確保你的網頁應用程式與底層程式碼之間的值能正確轉換。
如果參數的型別被更改, OnParameterChanged 該方法就會被呼叫。