ADO.NET Provider for Jira

Build 23.0.8839

DataAdapter を使用したクエリ

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

JIRADataAdapter の使用

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

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

C#

string connectionString = "User=admin;APIToken=myApiToken;Url=https://yoursitename.atlassian.net";

using (JIRAConnection connection = new JIRAConnection(connectionString)) {
  JIRADataAdapter dataAdapter = new JIRADataAdapter(
  "SELECT Key, Name FROM Projects", connection);

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

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

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

VB.NET

Dim connectionString As String = "User=admin;APIToken=myApiToken;Url=https://yoursitename.atlassian.net"

Using connection As New JIRAConnection(connectionString)
  Dim dataAdapter As New JIRADataAdapter("SELECT Key, Name FROM Projects", connection)

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

  Console.WriteLine("Contents of Projects.")

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

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