ADO.NET Provider for Jira Service Management

Build 23.0.8839

Querying with the DataAdapter

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

Using the JiraServiceDeskDataAdapter

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 JiraServiceDeskDataAdapter is slower than the JiraServiceDeskDataReader because the Fill method needs to retrieve all data from the data source before returning.

The following example selects the Id and Column1 columns of the Requests table:

C#

string connectionString = "ApiKey=myApiKey;User=MyUser;InitiateOAuth=GETANDREFRESH;";

using (JiraServiceDeskConnection connection = new JiraServiceDeskConnection(connectionString)) {
  JiraServiceDeskDataAdapter dataAdapter = new JiraServiceDeskDataAdapter(
  "SELECT Id, Column1 FROM Requests", connection);

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

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

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

VB.NET

Dim connectionString As String = "ApiKey=myApiKey;User=MyUser;InitiateOAuth=GETANDREFRESH;"

Using connection As New JiraServiceDeskConnection(connectionString)
  Dim dataAdapter As New JiraServiceDeskDataAdapter("SELECT Id, Column1 FROM Requests", connection)

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

  Console.WriteLine("Contents of Requests.")

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

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