ControlParameter 생성자

정의

ControlParameter 클래스의 새 인스턴스를 초기화합니다.

오버로드

ControlParameter()

ControlParameter 클래스의 명명되지 않은 새 인스턴스를 초기화합니다.

ControlParameter(ControlParameter)

지정된 인스턴스의 값을 사용하여 ControlParameter 클래스의 새 인스턴스를 초기화합니다.

ControlParameter(String, String)

바인딩할 컨트롤을 식별하는 지정된 컨트롤 이름을 사용하여 ControlParameter 클래스의 명명된 새 인스턴스를 초기화합니다.

ControlParameter(String, String, String)

바인딩할 컨트롤을 식별하는 컨트롤 이름과 지정된 속성 이름을 사용하여 ControlParameter 클래스의 명명된 새 인스턴스를 초기화합니다.

ControlParameter(String, DbType, String, String)

지정된 매개 변수 이름, 데이터베이스 형식, 컨트롤 ID 및 속성 이름을 사용하여 ControlParameter 클래스의 새 인스턴스를 초기화합니다.

ControlParameter(String, TypeCode, String, String)

바인딩할 컨트롤을 식별하는 컨트롤 이름과 지정된 속성 이름을 사용하여 ControlParameter 클래스에 대해 강력한 형식의 명명된 새 인스턴스를 초기화합니다.

ControlParameter()

ControlParameter 클래스의 명명되지 않은 새 인스턴스를 초기화합니다.

public:
 ControlParameter();
public ControlParameter ();
Public Sub New ()

예제

다음 코드를 만드는 방법을 보여 줍니다.는 ControlParameter 개체는 ControlParameter 생성자입니다. ControlParameter 바인딩합니다 개체를 SelectedValue 의 속성을 DropDownList 컨트롤에 표시 되는 데이터를 검색 하는 매개 변수가 있는 SQL 쿼리를 DataGrid 컨트롤.

<%@ Page Language="C#" CodeFile="param1acs.aspx.cs" Inherits="param1acs_aspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList
          runat="server"
          AutoPostBack="True"
          id="DropDownList1">
            <asp:ListItem Value="USA">USA</asp:ListItem>
            <asp:ListItem Value="UK">UK</asp:ListItem>
         </asp:DropDownList>

        <asp:DataGrid
          runat="server"
          id="DataGrid1" />    
    </div>
    </form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="param1avb.aspx.vb" Inherits="param1avb_aspx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DropDownList
          runat="server"
          AutoPostBack="True"
          id="DropDownList1">
            <asp:ListItem Value="USA">USA</asp:ListItem>
            <asp:ListItem Value="UK">UK</asp:ListItem>
         </asp:DropDownList>

        <asp:DataGrid
          runat="server"
          id="DataGrid1" />    
    </div>
    </form>
</body>
</html>

설명

A ControlParameter 사용 하 여 만든 개체는 ControlParameter 생성자는 모든 속성에 대 한 기본 값으로 초기화 됩니다. 합니다 ControlID 하 고 PropertyName 속성으로 초기화 됩니다 String.Empty합니다. 또한 합니다 Name 속성으로 초기화 됩니다 String.Empty, Type 속성으로 초기화 됩니다 TypeCode.ObjectDirection 속성으로 초기화 됩니다 Input, 및 DefaultValue 속성은 초기화 null.

적용 대상

ControlParameter(ControlParameter)

지정된 인스턴스의 값을 사용하여 ControlParameter 클래스의 새 인스턴스를 초기화합니다.

protected:
 ControlParameter(System::Web::UI::WebControls::ControlParameter ^ original);
protected ControlParameter (System.Web.UI.WebControls.ControlParameter original);
new System.Web.UI.WebControls.ControlParameter : System.Web.UI.WebControls.ControlParameter -> System.Web.UI.WebControls.ControlParameter
Protected Sub New (original As ControlParameter)

매개 변수

original
ControlParameter

현재 인스턴스가 초기화되는 ControlParameter 인스턴스입니다.

설명

합니다 ControlParameter 생성자는 복제에 사용 되는 보호 된 복사본 생성자는 ControlParameter 인스턴스. 값을 ControlParameter 개체를 포함 하 여는 ControlIDPropertyName, Name, 및 Type 속성은 모두를 새 인스턴스로 전달 됩니다.

추가 정보

적용 대상

ControlParameter(String, String)

바인딩할 컨트롤을 식별하는 지정된 컨트롤 이름을 사용하여 ControlParameter 클래스의 명명된 새 인스턴스를 초기화합니다.

public:
 ControlParameter(System::String ^ name, System::String ^ controlID);
public ControlParameter (string name, string controlID);
new System.Web.UI.WebControls.ControlParameter : string * string -> System.Web.UI.WebControls.ControlParameter
Public Sub New (name As String, controlID As String)

매개 변수

name
String

매개 변수의 이름입니다.

controlID
String

매개 변수가 바인딩되는 컨트롤의 이름입니다. 기본값은 Empty입니다.

설명

A ControlParameter 사용 하 여 만든 개체를 ControlParameter 생성자는 지정 된 매개 변수 이름으로 초기화 됩니다 및 Control 식별 하는 이름는 Control 매개 변수가 바인딩되는. 다른 속성을 포함 하 여 PropertyName, Type, 및 Direction, 기본 값으로 초기화 됩니다.

추가 정보

적용 대상

ControlParameter(String, String, String)

바인딩할 컨트롤을 식별하는 컨트롤 이름과 지정된 속성 이름을 사용하여 ControlParameter 클래스의 명명된 새 인스턴스를 초기화합니다.

public:
 ControlParameter(System::String ^ name, System::String ^ controlID, System::String ^ propertyName);
public ControlParameter (string name, string controlID, string propertyName);
new System.Web.UI.WebControls.ControlParameter : string * string * string -> System.Web.UI.WebControls.ControlParameter
Public Sub New (name As String, controlID As String, propertyName As String)

매개 변수

name
String

매개 변수의 이름입니다.

controlID
String

매개 변수가 바인딩되는 컨트롤의 이름입니다. 기본값은 Empty입니다.

propertyName
String

매개 변수가 바인딩되는 컨트롤의 속성 이름입니다. 기본값은 Empty입니다.

예제

다음 코드를 만드는 방법을 보여 줍니다 ControlParameter 사용 하 여 개체를 ControlParameter 생성자입니다. 매개 변수 값에 바인딩할 TextBoxDropDownList Web Forms 페이지에서 데이터베이스에 데이터를 입력 하는 컨트롤입니다.

private void Button1_Click(object sender, EventArgs e) {

    // The user has pressed the Submit button, prepare a parameterized
    // SQL query to insert the values from the controls.
    AccessDataSource1.InsertCommand =
    "INSERT INTO Employees (FirstName,LastName,Address,City,PostalCode,Country,ReportsTo) " +
    "  VALUES (?,?,?,?,?,?,? ); ";

    AccessDataSource1.InsertParameters.Add(
      new ControlParameter("FirstName", "TextBox1", "Text"));

    AccessDataSource1.InsertParameters.Add(
      new ControlParameter("LastName", "TextBox2", "Text"));

    AccessDataSource1.InsertParameters.Add(
      new ControlParameter("Address", "TextBox3", "Text"));

    AccessDataSource1.InsertParameters.Add(
      new ControlParameter("City", "TextBox4", "Text"));

    AccessDataSource1.InsertParameters.Add(
      new ControlParameter("PostalCode", "TextBox5", "Text"));

    AccessDataSource1.InsertParameters.Add(
      new ControlParameter("Country", "TextBox6", "Text"));

    AccessDataSource1.InsertParameters.Add(
      new ControlParameter("ReportsTo", "DropDownList1", "SelectedValue"));

    try {
        AccessDataSource1.Insert();
    }
    finally {
        Button1.Visible = false;
        Label9.Visible = true;
    }
}
Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

    ' The user has pressed the Submit button, prepare a parameterized
    ' SQL query to insert the values from the controls.
    AccessDataSource1.InsertCommand = _
    "INSERT INTO Employees (FirstName,LastName,Address,City,PostalCode,Country,ReportsTo) " & _
    "  VALUES (?,?,?,?,?,?,? ); "

    Dim firstName As New ControlParameter("FirstName", "TextBox1", "Text")
    AccessDataSource1.InsertParameters.Add(firstName)

    Dim lastName As New ControlParameter("LastName", "TextBox2", "Text")
    AccessDataSource1.InsertParameters.Add(lastName)

    Dim address As New ControlParameter("Address", "TextBox3", "Text")
    AccessDataSource1.InsertParameters.Add(address)

    Dim city As New ControlParameter("City", "TextBox4", "Text")
    AccessDataSource1.InsertParameters.Add(city)

    Dim postalCode As New ControlParameter("PostalCode", "TextBox5", "Text")
    AccessDataSource1.InsertParameters.Add(postalCode)

    Dim country As New ControlParameter("Country", "TextBox6", "Text")
    AccessDataSource1.InsertParameters.Add(country)

    Dim supervisor As New ControlParameter("ReportsTo", "DropDownList1", "SelectedValue")
    AccessDataSource1.InsertParameters.Add(supervisor)

    Try
        AccessDataSource1.Insert()
    Finally
        Button1.Visible = False
        Label9.Visible = True
    End Try

End Sub

설명

A ControlParameter 사용 하 여 만든 개체를 ControlParameter 생성자는 지정 된 매개 변수 이름을 사용 하 여 초기화 됩니다 Control 이름 및 PropertyName 속성을 식별 하는 Control 매개 변수가 바인딩되는 합니다. 다른 속성을 포함 하 여 Type, Direction, 및 ConvertEmptyStringToNull, 기본 값으로 초기화 됩니다.

추가 정보

적용 대상

ControlParameter(String, DbType, String, String)

지정된 매개 변수 이름, 데이터베이스 형식, 컨트롤 ID 및 속성 이름을 사용하여 ControlParameter 클래스의 새 인스턴스를 초기화합니다.

public:
 ControlParameter(System::String ^ name, System::Data::DbType dbType, System::String ^ controlID, System::String ^ propertyName);
public ControlParameter (string name, System.Data.DbType dbType, string controlID, string propertyName);
new System.Web.UI.WebControls.ControlParameter : string * System.Data.DbType * string * string -> System.Web.UI.WebControls.ControlParameter
Public Sub New (name As String, dbType As DbType, controlID As String, propertyName As String)

매개 변수

name
String

매개 변수의 이름입니다.

dbType
DbType

매개 변수의 데이터 형식입니다.

controlID
String

매개 변수가 바인딩되는 컨트롤의 이름입니다. 기본값은 Empty입니다.

propertyName
String

매개 변수가 바인딩되는 컨트롤의 속성 이름입니다. 기본값은 Empty입니다.

적용 대상

ControlParameter(String, TypeCode, String, String)

바인딩할 컨트롤을 식별하는 컨트롤 이름과 지정된 속성 이름을 사용하여 ControlParameter 클래스에 대해 강력한 형식의 명명된 새 인스턴스를 초기화합니다.

public:
 ControlParameter(System::String ^ name, TypeCode type, System::String ^ controlID, System::String ^ propertyName);
public ControlParameter (string name, TypeCode type, string controlID, string propertyName);
new System.Web.UI.WebControls.ControlParameter : string * TypeCode * string * string -> System.Web.UI.WebControls.ControlParameter
Public Sub New (name As String, type As TypeCode, controlID As String, propertyName As String)

매개 변수

name
String

매개 변수의 이름입니다.

type
TypeCode

매개 변수가 나타내는 형식입니다. 기본값은 Object입니다.

controlID
String

매개 변수가 바인딩되는 컨트롤의 이름입니다. 기본값은 Empty입니다.

propertyName
String

매개 변수가 바인딩되는 컨트롤의 속성 이름입니다. 기본값은 Empty입니다.

예제

다음 코드를 사용 하는 방법을 보여 줍니다는 ControlParameter 를 만드는 두 개의 생성자 ControlParameter 개체에 연결 하는 SqlDataSource 컨트롤입니다.


ControlParameter country =
  new ControlParameter("country",TypeCode.String,"ListBox1","SelectedValue");
sqlSource.SelectParameters.Add(country);

ControlParameter report  =
  new ControlParameter("report",TypeCode.Int16,"ListBox2","SelectedValue");
sqlSource.SelectParameters.Add(report);


Dim country As ControlParameter
country = New ControlParameter("country", TypeCode.String, "ListBox1", "SelectedValue")

Dim report As ControlParameter
report = New ControlParameter("report", TypeCode.Int16, "ListBox2", "SelectedValue")

설명

A ControlParameter 사용 하 여 만든 개체를 ControlParameter 생성자는 지정 된 매개 변수 이름을 사용 하 여 초기화 됩니다 TypeControl 이름 및 PropertyName 속성입니다. 만 DirectionConvertEmptyStringToNull 속성이 기본 값으로 초기화 됩니다.

추가 정보

적용 대상