Parameter Constructor (String, TypeCode, String)
.NET Framework 2.0
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)
Assembly: System.Web (in system.web.dll)
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.
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.
<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.
Community Additions
ADD
Show: