ControlParameter 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
ControlParameter 클래스의 새 인스턴스를 초기화합니다.
오버로드
| Name | Description |
|---|---|
| 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 표시되는 데이터를 검색하는 매개 변수가 있는 SQL 쿼리에 DataGrid 컨트롤의 DropDownList 속성을 바인딩합니다.
<%@ 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>
설명
ControlParameter 생성자를 사용하여 ControlParameter 만든 개체는 모든 속성에 대한 기본값으로 초기화됩니다. 및 PropertyName 속성은 ControlID .로 String.Empty초기화됩니다. 또한 속성이 Name 초기화 String.Empty되고, Type 속성이 초기화 TypeCode.Object되고, Direction 속성이 초기화 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 하는 데 사용되는 보호된 복사 생성자입니다. , PropertyName, Name및 Type 속성을 포함한 ControlID개체의 ControlParameter 값은 모두 새 인스턴스로 전송됩니다.
추가 정보
적용 대상
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
매개 변수의 이름입니다.
설명
ControlParameter 생성자를 사용하여 ControlParameter 만든 개체는 매개 변수가 바인딩하는 개체를 식별하는 Control 지정된 매개 변수 이름 및 Control 이름으로 초기화됩니다. 를 비롯한 PropertyNameTypeDirection기타 속성은 기본값으로 초기화됩니다.
추가 정보
적용 대상
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
매개 변수의 이름입니다.
예제
다음 코드는 생성자를 사용하여 개체를 ControlParameter 만드는 ControlParameter 방법을 보여줍니다. 매개 변수는 Web Forms 페이지에서 데이터베이스에 데이터를 입력하는 컨트롤 및 TextBoxDropDownList 값에 바인딩됩니다.
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
설명
ControlParameter 생성자를 사용하여 ControlParameter 만든 개체는 매개 변수가 바인딩하는 개체를 식별하는 Control 지정된 매개 변수 이름, Control 이름 및 PropertyName 속성으로 초기화됩니다. 를 비롯한 TypeDirectionConvertEmptyStringToNull기타 속성은 기본값으로 초기화됩니다.
추가 정보
적용 대상
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
매개 변수의 데이터 형식입니다.
적용 대상
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
매개 변수의 이름입니다.
예제
다음 코드에서는 생성자를 사용하여 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")
설명
ControlParameter 생성자를 사용하여 ControlParameter 만든 개체는 지정된 매개 변수 이름, TypeControl 이름 및 PropertyName 속성으로 초기화됩니다. Direction 및 ConvertEmptyStringToNull 속성만 기본값으로 초기화됩니다.