SqlDataSourceStatusEventArgs.Command プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SqlDataSourceStatusEventArgs.Command プロパティの意味・解説 

SqlDataSourceStatusEventArgs.Command プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

データベース送信されデータベース コマンド取得します

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

Dim instance As SqlDataSourceStatusEventArgs
Dim value As DbCommand

value = instance.Command
public DbCommand Command { get; }
public:
property DbCommand^ Command {
    DbCommand^ get ();
}
/** @property */
public DbCommand get_Command ()

プロパティ
データベース送信されデータベース コマンドを表す DbCommand オブジェクト

解説解説
使用例使用例

SqlDataSource コントロールストアド プロシージャ使用する場合に、出力パラメータの値をチェックする方法次のコード例示しますSqlDataSourceストアド プロシージャ使用するパラメータは、SelectParameters コレクション格納されWeb フォームからの情報ストアド プロシージャに渡すためのパラメータと、フォーム情報返すためのパラメータとで構成されます。このコード例は、SqlDataSourceStatusEventArgs クラストピック取り上げているコード例一部分です。

<%@Page  Language="VB" %>
<%@Import Namespace="System.Data"
 %>
<%@Import Namespace="System.Data.Common"
 %>
<%@Import Namespace="System.Data.SqlClient"
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat="server">
' Clicking the Submit button explicitly refreshes the data 
' by calling the Select() method.
Private Sub Submit(source As
 Object, e As EventArgs)
  
  SqlDataSource1.Select(DataSourceSelectArguments.Empty)
  
End Sub ' Submit

' This event handler is called after the Select() method is executed.
Private Sub OnSelectedHandler(source As
 Object, e As SqlDataSourceStatusEventArgs)

  Dim cmd As IDbCommand 
  cmd = e.Command
  Dim param As SqlParameter
  
  Label1.Text = "Parameter return values: "
  
  For Each param In cmd.Parameters
    
    ' Extract the name and value of the parameter.
    Label1.Text = Label1.Text & param.ParameterName & "
 - " & _
                  param.Value.ToString()

  Next

End Sub ' OnSelectedHandler
</SCRIPT>

<html>
  <body>
    <form runat="server">
        <asp:sqldatasource
            id="SqlDataSource1"
            runat="server"
            datasourcemode="DataSet"
            connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
            selectcommand="getordertotal"
            onselected="OnSelectedHandler">
            <selectparameters>
              <asp:querystringparameter name="empId"
 querystringfield="empId" />
              <asp:parameter name="total" type="Int32"
 direction="Output" defaultvalue="0"
 />
              <asp:parameter name="_ret" type="Int32"
 direction="ReturnValue" defaultvalue="0"
 />
            </selectparameters>
        </asp:sqldatasource>
        <!--
          CREATE PROCEDURE dbo.getordertotal
            @empId int,
            @total int OUTPUT
          as
            set nocount on
            select @total    = count(1) from orders where employeeid=@empid;
            select * from orders where employeeID = @empId ;
            return (-1000);
          GO
        -->

        <asp:gridview
          id="GridView1"
          runat="server"
          allowpaging="True"
          pagesize="5"
          datasourceid="SqlDataSource1" />

        <asp:button
          id="Button1"
          runat="server"
          onclick="Submit"
          text="Refresh Data" />

        <asp:label id="Label1" runat="server"
 />

    </form>
  </body>
</html>
<%@Page  Language="C#" %>
<%@Import Namespace="System.Data" %>
<%@Import Namespace="System.Data.Common" %>
<%@Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT runat="server">
// Clicking the Submit button explicitly refreshes the data 
// by calling the Select() method.
private void Submit(Object source, EventArgs
 e) {
  SqlDataSource1.Select(DataSourceSelectArguments.Empty);
}

// This event handler is called after the Select() method is executed.
private void OnSelectedHandler(Object source,
 SqlDataSourceStatusEventArgs e) {

  IDbCommand cmd = e.Command; 
  
  Label1.Text = "Parameter return values: ";

  foreach (SqlParameter param in cmd.Parameters)
 {
    //  Extract the value of the parameter.
    Label1.Text += param.ParameterName + " - " + param.Value.ToString();
  }
}
</SCRIPT>

<html>
  <body>
    <form runat="server">
        <asp:sqldatasource
            id="SqlDataSource1"
            runat="server"
            datasourcemode="DataSet"
            connectionstring="<%$ ConnectionStrings:MyNorthwind%>"
            selectcommand="getordertotal"
            onselected="OnSelectedHandler">
            <selectparameters>
              <asp:querystringparameter name="empId" querystringfield="empId"
 />
              <asp:parameter name="total" type="Int32" direction="Output"
 defaultvalue="0" />
              <asp:parameter name="_ret" type="Int32" direction="ReturnValue"
 defaultvalue="0" />
            </selectparameters>
        </asp:sqldatasource>
        <!--
          CREATE PROCEDURE dbo.getordertotal
            @empId int,
            @total int OUTPUT
          as
            set nocount on
            select @total    = count(1) from orders where employeeid=@empid;
            select * from orders where employeeID = @empId ;
            return (-1000);
          GO
        -->

        <asp:gridview
          id="GridView1"
          runat="server"
          allowpaging="True"
          pagesize="5"
          datasourceid="SqlDataSource1" />

        <asp:button
          id="Button1"
          runat="server"
          onclick="Submit"
          text="Refresh Data" />

        <asp:label id="Label1" runat="server" />

    </form>
  </body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SqlDataSourceStatusEventArgs クラス
SqlDataSourceStatusEventArgs メンバ
System.Web.UI.WebControls 名前空間
SqlDataSource.Selected イベント
SqlDataSource.Updated イベント
SqlDataSource.Inserted イベント
SqlDataSource.Deleted イベント


このページでは「.NET Framework クラス ライブラリ リファレンス」からSqlDataSourceStatusEventArgs.Command プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からSqlDataSourceStatusEventArgs.Command プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からSqlDataSourceStatusEventArgs.Command プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

SqlDataSourceStatusEventArgs.Command プロパティのお隣キーワード
検索ランキング

   

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



SqlDataSourceStatusEventArgs.Command プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS