Connect to Linear Data from PowerBuilder via ADO.NET

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
This article demonstrates how to access Linear data from Appeon PowerBuilder using the CData ADO.NET Provider for Linear.

This article demonstrates using the CData ADO.NET Provider for Linear in PowerBuilder, showcasing the ease of use and compatibility of these standards-based controls across various platforms and development technologies that support Microsoft .NET, including Appeon PowerBuilder.

This article shows how to create a basic PowerBuilder application that uses the CData ADO.NET Provider for Linear to retrieve data.

  1. In a new WPF Window Application solution, add all the Visual Controls needed for the connection properties. Below is a typical connection string:

    AuthScheme=APIKey;APIKey=myAPIKey;

    You can authenticate to Linear with a personal API key or with OAuth 2.0. The API key is the simplest option for connecting with your own Linear account.

    Authenticating with an API Key

    Set the following connection properties:

    • AuthScheme: Set this to APIKey.
    • APIKey: A Linear personal API key.

    To create a personal API key, log in to Linear, open Settings > Security & access > Personal API keys, select New API key, and create it. Copy the key immediately, because Linear shows it only once.

    Authenticating with OAuth

    OAuth requires a custom OAuth application registered in Linear (Settings > API > OAuth applications), which provides the OAuthClientId and OAuthClientSecret. Two flows are supported:

    • Authorization code: Set AuthScheme to OAuth, InitiateOAuth to GETANDREFRESH, and provide OAuthClientId, OAuthClientSecret, and the CallbackURL defined in your application (e.g., http://localhost:33333). The driver opens Linear in your browser so you can grant access.
    • Client credentials: Set AuthScheme to OAuthClient and provide OAuthClientId and OAuthClientSecret. This authenticates the application itself, with no browser interaction, and suits machine-to-machine integrations.

    By default, the driver requests the read,write scopes. The driver refreshes the access token automatically when it expires.

  2. Add the DataGrid control from the .NET controls.
  3. Configure the columns of the DataGrid control. Below are several columns from the Account table:
    
    
    <DataGrid AutoGenerateColumns="False" Margin="13,249,12,14" Name="datagrid1" TabIndex="70" ItemsSource="{Binding}">
    <DataGrid.Columns>
        <DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=Id}" Header="Id" Width="SizeToHeader" />
        <DataGridTextColumn x:Name="nameColumn" Binding="{Binding Path=id}" Header="id" Width="SizeToHeader" />
    		...
    	</DataGrid.Columns>
    </DataGrid>
    
  4. Add a reference to the CData ADO.NET Provider for Linear assembly.

Connect the DataGrid

Once the visual elements have been configured, you can use standard ADO.NET objects like Connection, Command, and DataAdapter to populate a DataTable with the results of an SQL query:


System.Data.CData.Linear.LinearConnection conn 
conn = create System.Data.CData.Linear.LinearConnection(connectionString)

System.Data.CData.Linear.LinearCommand comm 
comm = create System.Data.CData.Linear.LinearCommand(command, conn)

System.Data.DataTable table
table = create System.Data.DataTable

System.Data.CData.Linear.LinearDataAdapter dataAdapter
dataAdapter = create System.Data.CData.Linear.LinearDataAdapter(comm)
dataAdapter.Fill(table)	
datagrid1.ItemsSource=table.DefaultView

The code above can be used to bind data from the specified query to the DataGrid.

Ready to get started?

Download a free trial of the Linear Data Provider to get started:

 Download Now

Learn more:

Linear Icon Linear ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Linear data including AgentSession, Comment, Customer, Cycle, Initiative, Integration, Issue, ProjectStatus, Release, Team, User, and more!