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



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

辞書ショートカット

すべての辞書の索引

「DataRowCollection クラス」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS