Parameter Constructor (String, TypeCode, String)

Note: This constructor is new in the .NET Framework version 2.0.

Initializes a new instance of the Parameter class, using the specified name, the specified type, and the specified string for its DefaultValue property.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public:
Parameter (
	String^ name, 
	TypeCode type, 
	String^ defaultValue
)
public Parameter (
	String name, 
	TypeCode type, 
	String defaultValue
)
public function Parameter (
	name : String, 
	type : TypeCode, 
	defaultValue : String
)

Parameters

name

The name of the parameter.

type

A TypeCode that describes the type of the parameter.

defaultValue

A string that serves as a default value for the parameter, if the Parameter is bound to a value that is not yet initialized when Evaluate is called.

A Parameter object created with the Parameter(String,TypeCode,String) constructor is initialized with the specified name parameter and type parameter, and assigned a DefaultValue property value. The Direction property is initialized to Input.

The following code example demonstrates how to use the Parameter(String,TypeCode,String) constructor to add update parameter objects to the UpdateParameters collection of an AccessDataSource control before calling the Update method.

No code example is currently available or this language may not be supported.
<SCRIPT runat="server">
    private void UpdateRecords(Object source, System.EventArgs e)
    {
        // This method is an example of batch updating using a
        // data source control. The method iterates through the rows
        // of the GridView, extracts each CheckBox from the row and, if
        // the CheckBox is checked, updates data by calling the Update
        // method of the data source control, adding required parameters
        // to the UpdateParameters collection.
        CheckBox cb;
        for (int iCtr = 0; 
                iCtr < this.GridView1.get_Rows().get_Count(); iCtr++) {
            GridViewRow row = this.GridView1.get_Rows().get_Item(iCtr);
            cb = (CheckBox)row.get_Cells().get_Item(0).get_Controls().get_Item(1);
            if (cb.get_Checked()) {
                String oid = (String)(row.get_Cells().get_Item(1).get_Text());
                MyAccessDataSource.get_UpdateParameters().Add(new Parameter(
                    "date", System.TypeCode.DateTime, System.DateTime.get_Now().ToString()));
                MyAccessDataSource.get_UpdateParameters().Add(new Parameter(
                    "orderid", System.TypeCode.String, oid));
                MyAccessDataSource.Update();
                MyAccessDataSource.get_UpdateParameters().Clear();
            }
        }
    } //UpdateRecords
</SCRIPT>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: