ADO.NET Provider for Jira

Build 23.0.8839

Querying with the DataAdapter

The CData ADO.NET Provider for Jira implements two ADO.NET interfaces you can use to retrieve data from Jira: JIRADataAdapter and JIRADataReader objects. Whereas JIRADataAdapter objects retrieve a single result set of all the data that matches a query, JIRADataReader objects fetch data in subset increments as needed.

Using the JIRADataAdapter

Use the adapter's Fill method to retrieve data from the data source. An empty DataTable instance is passed as an argument to the Fill method. When the method returns, the DataTable instance is populated with the queried data. Note that the JIRADataAdapter is slower than the JIRADataReader because the Fill method needs to retrieve all data from the data source before returning.

The following example selects the Key and Name columns of the Projects table:

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