DataRowCollectionとは? わかりやすく解説

DataRowCollection クラス

DataTable の行のコレクション表します

名前空間: System.Data
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public NotInheritable Class
 DataRowCollection
    Inherits InternalDataCollectionBase
Dim instance As DataRowCollection
public sealed class DataRowCollection : InternalDataCollectionBase
public ref class DataRowCollection sealed :
 public InternalDataCollectionBase
public final class DataRowCollection extends
 InternalDataCollectionBase
public final class DataRowCollection extends
 InternalDataCollectionBase
解説解説

DataRowCollectionDataTable の主要コンポーネントです。DataColumnCollection がテーブルスキーマ定義するに対してDataRowCollectionテーブル実際のデータ格納しますDataRowCollection格納された各 DataRow は単一行を表します

DataRowCollectionDataRow オブジェクト挿入するには Add メソッド呼び出しオブジェクト削除するには Remove メソッド呼び出します。主キー内の特定の値格納する DataRow オブジェクト検索するには Find メソッド呼び出し文字ベースデータ内にある単一単語または語句検索するには Contains メソッド呼び出します。

使用例使用例

このセクション最初の例では、DataRowCollection 内の各行の列 1 の値を出力します2 番目の例では、NewRow メソッド使用して作成した新しい行を DataRowCollection追加します

Private Sub ShowRows(Byval
 table As DataTable)
    ' Print the number of rows in the collection.
    Console.WriteLine(table.Rows.Count)

    Dim row  As DataRow
    ' Print the value of columns 1 in each row
    For Each row In table.Rows
        Console.WriteLine(row(1))
    Next
End Sub
 
Private Sub AddRow(ByVal
 table As DataTable)
    ' Instantiate a new row using the NewRow method.
    Dim newRow As DataRow = table.NewRow()
    ' Insert code to fill the row with values.

    ' Add the row to the DataRowCollection.
    table.Rows.Add(newRow)
End Sub
private void ShowRows(DataTable table)
{
    // Print the number of rows in the collection.
    Console.WriteLine(table.Rows.Count);
    // Print the value of columns 1 in each row
    foreach(DataRow row in table.Rows)
    {
        Console.WriteLine(row[1]);
    }
}
 
private void AddRow(DataTable table)
{
    DataRowCollection rowCollection = table.Rows;
    // Instantiate a new row using the NewRow method.

    DataRow newRow = table.NewRow();
    // Insert code to fill the row with values.

    // Add the row to the DataRowCollection.
    table.Rows.Add(newRow);
}
継承階層継承階層
System.Object
   System.Data.InternalDataCollectionBase
    System.Data.DataRowCollection
スレッド セーフスレッド セーフ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataRowCollection メンバ
System.Data 名前空間
DataRow クラス
DataTable
NewRow

DataRowCollection プロパティ


パブリック プロパティパブリック プロパティ

( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ Count オーバーライドされます。 このコレクション内の DataRow オブジェクト合計数を取得します
パブリック プロパティ IsReadOnly  InternalDataCollectionBase が読み取り専用かどうかを示す値を取得します。 ( InternalDataCollectionBase から継承されます。)
パブリック プロパティ IsSynchronized  InternalDataCollectionBase同期がとられているかどうかを示す値を取得します。 ( InternalDataCollectionBase から継承されます。)
パブリック プロパティ SyncRoot  コレクション同期をとるために使用できるオブジェクト取得します。 ( InternalDataCollectionBase から継承されます。)
プロテクト プロパティプロテクト プロパティ
参照参照

関連項目

DataRowCollection クラス
System.Data 名前空間
DataRow クラス
DataTable
NewRow

DataRowCollection メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add オーバーロードされます。 DataRow を DataRowCollection に追加します
パブリック メソッド Clear すべての行のコレクション消去します。
パブリック メソッド Contains オーバーロードされます。 このコレクション内のいずれかの行の主キー列に指定した値が格納されているかどうかを示す値を取得します
パブリック メソッド CopyTo オーバーロードされますオーバーライドされます。 このコレクション内のすべての DataRow オブジェクトを、指定したコピー配列インデックスから始まる指定した配列コピーします
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 ( Object から継承されます。)
パブリック メソッド Find オーバーロードされます指定した DataRow取得します
パブリック メソッド GetEnumerator オーバーライドされます。 このコレクションの IEnumerator を取得します
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 ( Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IndexOf 指定した DataRow オブジェクトインデックス取得します
パブリック メソッド InsertAt コレクション内の指定した位置新しい行を挿入します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド Remove 指定した DataRowコレクションから削除します
パブリック メソッド RemoveAt 指定したインデックス位置にある行をコレクションから削除します
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DataRowCollection クラス
System.Data 名前空間
DataRow クラス
DataTable
NewRow

DataRowCollection メンバ

DataTable の行のコレクション表します

DataRowCollection データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
( プロテクト プロパティ参照)
  名前 説明
パブリック プロパティ Count オーバーライドされます。 このコレクション内の DataRow オブジェクト合計数を取得します
パブリック プロパティ IsReadOnly  InternalDataCollectionBase が読み取り専用かどうかを示す値を取得します。(InternalDataCollectionBase から継承されます。)
パブリック プロパティ IsSynchronized  InternalDataCollectionBase同期がとられているかどうかを示す値を取得します。(InternalDataCollectionBase から継承されます。)
パブリック プロパティ SyncRoot  コレクション同期をとるために使用できるオブジェクト取得します。(InternalDataCollectionBase から継承されます。)
プロテクト プロパティプロテクト プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Add オーバーロードされます。 DataRow を DataRowCollection に追加します
パブリック メソッド Clear すべての行のコレクション消去します。
パブリック メソッド Contains オーバーロードされます。 このコレクション内のいずれかの行の主キー列に指定した値が格納されているかどうかを示す値を取得します
パブリック メソッド CopyTo オーバーロードされますオーバーライドされます。 このコレクション内のすべての DataRow オブジェクトを、指定したコピー配列インデックスから始まる指定した配列コピーします
パブリック メソッド Equals  オーバーロードされます2 つObject インスタンス等しかどうか判断します。 (Object から継承されます。)
パブリック メソッド Find オーバーロードされます指定した DataRow取得します
パブリック メソッド GetEnumerator オーバーライドされます。 このコレクションの IEnumerator を取得します
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用適してます。 (Object から継承されます。)
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IndexOf 指定した DataRow オブジェクトインデックス取得します
パブリック メソッド InsertAt コレクション内の指定した位置新しい行を挿入します
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド Remove 指定した DataRowコレクションから削除します
パブリック メソッド RemoveAt 指定したインデックス位置にある行をコレクションから削除します
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

DataRowCollection クラス
System.Data 名前空間
DataRow クラス
DataTable
NewRow


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

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

辞書ショートカット

すべての辞書の索引

「DataRowCollection」の関連用語

DataRowCollectionのお隣キーワード
検索ランキング

   

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



DataRowCollectionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS