SessionParameter コンストラクタとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SessionParameter コンストラクタの意味・解説 

SessionParameter コンストラクタ (SessionParameter)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

original パラメータ指定されインスタンスの値を使用してSessionParameter クラス新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Sub New ( _
    original As SessionParameter _
)
Dim original As SessionParameter

Dim instance As New SessionParameter(original)
protected SessionParameter (
    SessionParameter original
)
protected:
SessionParameter (
    SessionParameter^ original
)
protected SessionParameter (
    SessionParameter original
)
protected function SessionParameter (
    original : SessionParameter
)

パラメータ

original

現在のインスタンス初期化の基になる SessionParameter。

解説解説

SessionParameter(SessionParameter) コンストラクタは、SessionParameter インスタンスクローン作成するための Protected コピー コンストラクタです。SessionParameter オブジェクトの値 (SessionField、NameType プロパティなど) が、すべて新しインスタンス転送されます。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SessionParameter クラス
SessionParameter メンバ
System.Web.UI.WebControls 名前空間
Clone

SessionParameter コンストラクタ (String, String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

バインド先の HTTP Cookie識別する文字列指定して、SessionParameter クラスの名前付きの新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    name As String, _
    sessionField As String _
)
Dim name As String
Dim sessionField As String

Dim instance As New SessionParameter(name,
 sessionField)
public SessionParameter (
    string name,
    string sessionField
)
public:
SessionParameter (
    String^ name, 
    String^ sessionField
)
public SessionParameter (
    String name, 
    String sessionField
)
public function SessionParameter (
    name : String, 
    sessionField : String
)

パラメータ

name

パラメータの名前。

sessionField

パラメータ オブジェクトバインド先の HttpSessionState 名前/値ペアの名前。既定値Empty です。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SessionParameter クラス
SessionParameter メンバ
System.Web.UI.WebControls 名前空間
Parameter.Name プロパティ
SessionField

SessionParameter コンストラクタ (String, TypeCode, String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

バインド先の HTTP Cookie識別する文字列指定して、SessionParameter クラス厳密に指定された名前付きの新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    name As String, _
    type As TypeCode, _
    sessionField As String _
)
Dim name As String
Dim type As TypeCode
Dim sessionField As String

Dim instance As New SessionParameter(name,
 type, sessionField)
public SessionParameter (
    string name,
    TypeCode type,
    string sessionField
)
public:
SessionParameter (
    String^ name, 
    TypeCode type, 
    String^ sessionField
)
public SessionParameter (
    String name, 
    TypeCode type, 
    String sessionField
)
public function SessionParameter (
    name : String, 
    type : TypeCode, 
    sessionField : String
)

パラメータ

name

パラメータの名前。

type

パラメータが表す型。既定値は TypeCode.Object です。

sessionField

パラメータ オブジェクトバインド先の HttpSessionState 名前/値ペアの名前。既定値Empty です。

解説解説
使用例使用例

SessionParameter コンストラクタ使用して SessionParameter オブジェクト作成し、それを SqlDataSource コントロールと共に使用してデータを DataGrid コントロール表示する方法次のコード例示します

<%@ Page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat="server">
Private Sub Page_Load(sender As
 Object, e As EventArgs)

    Dim OdbcToSql As New
 SqlDataSource()

    ' Connect to SQL Server using an ODBC DSN.
    OdbcToSql.ProviderName= "System.Data.Odbc"
    OdbcToSql.ConnectionString = "dsn=MyOdbcDsn;"

    ' Use an ODBC parameterized query syntax.
    OdbcToSql.SelectCommand = "SELECT EmployeeID FROM Employees
 " & _
                              " WHERE Country = ? AND ReportsTo
 = ?"

    ' The country parameter has no default value, so be sure to set
    ' a Session variable named "country" to "UK"
 or "USA".
    Dim country As SessionParameter
    country = New SessionParameter("country"
,TypeCode.String,"country")

    Dim reportsTo As SessionParameter
    reportsTo = New SessionParameter("report"
,TypeCode.Int32,"report")
    reportsTo.DefaultValue = "2"

    OdbcToSql.SelectParameters.Add(country)
    OdbcToSql.SelectParameters.Add(reportsTo)

    ' Add the DataSourceControl to the page's Controls collection.
    Page.Controls.Add(OdbcToSql)

    DataGrid1.DataSource = OdbcToSql
    DataGrid1.DataBind()

End Sub ' Page_Load

</SCRIPT>
<HTML>
  <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post"
 runat="server">
      <asp:DataGrid
          id="DataGrid1"
          style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute;
 TOP: 56px"
          runat="server" />
    </form>
  </body>
</HTML>
<%@ Page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat="server">
private void Page_Load(object sender, System.EventArgs
 e)
{
    SqlDataSource OdbcToSql = new SqlDataSource();

    // Connect to SQL Server using an ODBC DSN.
    OdbcToSql.ProviderName= "System.Data.Odbc";
    OdbcToSql.ConnectionString = "dsn=MyOdbcDsn;";

    // Use an ODBC parameterized query syntax.
    OdbcToSql.SelectCommand = "SELECT EmployeeID FROM Employees " +
                              " WHERE Country = ? AND ReportsTo = ?";

    // The country parameter has no default value, so be sure to set
    // a Session variable named "country" to "UK"
 or "USA".
    SessionParameter country =
        new SessionParameter("country",TypeCode.String
,"country");

    SessionParameter reportsTo =
        new SessionParameter("report",TypeCode.Int32
,"report");
    reportsTo.DefaultValue = "2";

    OdbcToSql.SelectParameters.Add(country);
    OdbcToSql.SelectParameters.Add(reportsTo);

    // Add the DataSourceControl to the page's Controls collection.
    Page.Controls.Add(OdbcToSql);

    DataGrid1.DataSource = OdbcToSql;
    DataGrid1.DataBind();
}

</SCRIPT>
<HTML>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:DataGrid
                id="DataGrid1"
                style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 56px"
                runat="server" />
        </form>
    </body>
</HTML>
<%@ Page language="VJ#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat="server">
private void Page_Load(Object sender, System.EventArgs
 e)
{
    SqlDataSource odbcToSql = new SqlDataSource();

    // Connect to SQL Server using an ODBC DSN.
    odbcToSql.set_ProviderName("System.Data.Odbc");
    odbcToSql.set_ConnectionString("dsn=MyOdbcDsn;");

    // Use an ODBC parameterized query syntax.
    odbcToSql.set_SelectCommand("SELECT EmployeeID FROM Employees " 
        + " WHERE Country = ? AND ReportsTo = ?");

    // The country parameter has no default value, so be sure to set
    // a Session variable named "country" to "UK"
 or "USA".
    SessionParameter country =
        new SessionParameter("country",System.TypeCode.String
,"country");

    SessionParameter reportsTo =
        new SessionParameter("report",System.TypeCode.Int32
,"report");

    reportsTo.set_DefaultValue("2");
    odbcToSql.get_SelectParameters().Add(country);
    odbcToSql.get_SelectParameters().Add(reportsTo);

    // Add the DataSourceControl to the page's Controls collection.
    get_Page().get_Controls().Add(odbcToSql);
    DataGrid1.set_DataSource(odbcToSql);
    DataGrid1.DataBind();
} //Page_Load

</SCRIPT>
<HTML>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <asp:DataGrid
                id="DataGrid1"
                style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 56px"
                runat="server" />
        </form>
    </body>
</HTML>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SessionParameter クラス
SessionParameter メンバ
System.Web.UI.WebControls 名前空間
Parameter.Name プロパティ
SessionField

SessionParameter コンストラクタ

SessionParameter クラス新しインスタンス初期化します。
オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

SessionParameter クラス
SessionParameter メンバ
System.Web.UI.WebControls 名前空間

SessionParameter コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

SessionParameter クラスの名前のない新しインスタンス初期化します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Dim instance As New SessionParameter
public SessionParameter ()
public:
SessionParameter ()
public SessionParameter ()
public function SessionParameter ()
解説解説

SessionParameter コンストラクタ作成されSessionParameter オブジェクトは、すべてのプロパティ既定値使用して初期化されます。SessionField プロパティは String.Empty に初期化されますまた、Name プロパティString.Empty初期化され、Type プロパティは TypeCode.Object に初期化されます。さらに、Direction プロパティは ParameterDirection.Input に初期化され、DefaultValue プロパティnull 参照 (Visual Basic では Nothing) に初期化されます

使用例使用例

SessionParameter コンストラクタ使用してSessionParameter クラス既定インスタンス作成する方法次のコード例示します

' In this example, the session parameter "empid" is set
' after the employee successfully logs in.
Dim empid As New SessionParameter()
empid.Name = "empid"
empid.Type = TypeCode.Int32
empid.SessionField = "empid"
// In this example, the session parameter "empid" is set
// after the employee successfully logs in.
SessionParameter empid = new SessionParameter();
empid.Name = "empid";
empid.Type = TypeCode.Int32;
empid.SessionField = "empid";
// In this example, the session parameter "empid" is set
// after the employee successfully logs in.
SessionParameter empid = new SessionParameter();
empid.set_Name("empid");
empid.set_Type(System.TypeCode.Int32);
empid.set_SessionField("empid");
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SessionParameter クラス
SessionParameter メンバ
System.Web.UI.WebControls 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SessionParameter コンストラクタ」の関連用語

SessionParameter コンストラクタのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SessionParameter コンストラクタのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS