ADO.NET Provider for Trello

Build 23.0.8839

DataAdapter を使用したクエリ

CData ADO.NET Provider for Trello では、次の2つのネイティブ.NET インターフェースを使用して、Trello からデータを取得できます。TrelloDataAdapter オブジェクトおよびTrelloDataReader オブジェクト。各オブジェクトは同じタスク(データの取得)を実行しますが、実行方法が異なります。TrelloDataAdapter オブジェクトはクエリに一致するすべてのデータを取得しますが、TrelloDataReader オブジェクトは必要に応じてインクリメントしながら一部のデータだけをフェッチします。

TrelloDataAdapter の使用

アダプターのFill メソッドを使用して、データソースからデータを取得します。空のDataTable インスタンスがFill メソッドへの引数として渡されます。このメソッドが戻ってきたとき、DataTable インスタンスにはクエリされたデータが設定されています。Fill メソッドは、戻る前にデータソースからすべてのデータを取得する必要があるため、TrelloDataAdapter はTrelloDataReader よりも時間がかかります。

次の例は、Cards テーブルのName カラムとListId カラムを選択します。

C#

string connectionString = "APIKey=myApiKey;Token=myGeneratedToken;";

using (TrelloConnection connection = new TrelloConnection(connectionString)) {
  TrelloDataAdapter dataAdapter = new TrelloDataAdapter(
  "SELECT Name, ListId FROM Cards", connection);

  DataTable table = new DataTable();
  dataAdapter.Fill(table);

  Console.WriteLine("Contents of Cards.");

  foreach (DataRow row in table.Rows) {
    Console.WriteLine("{0}: {1}", row["Name"], row["ListId"]);
  }
}

VB.NET

Dim connectionString As String = "APIKey=myApiKey;Token=myGeneratedToken;"

Using connection As New TrelloConnection(connectionString)
  Dim dataAdapter As New TrelloDataAdapter("SELECT Name, ListId FROM Cards", connection)

  Dim table As New DataTable()
  dataAdapter.Fill(table)

  Console.WriteLine("Contents of Cards.")

  For Each row As DataRow In table.Rows
    Console.WriteLine("{0}: {1}", row("Name"), row("ListId"))
  Next
End Using

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839