Binding CockroachDB Data to List & Label

CockroachDB is a cloud-based relational database system. The SQL syntax is closely based on PostgreSQL, so PostgreSQL-compatible drivers can be used for most applications - including reporting with List & Label.

To connect to a CockroachDB cluster only a few lines of code are necessary. You can get the needed information by clicking the Connect button in the cluster configuration:

In the following dialog you can copy the entries for User, Host, Database and Port:

You then use this information to create the connection string:

NpgsqlConnectionStringBuilder builder = new NpgsqlConnectionStringBuilder();
builder.Username = "...";
builder.Password = "...";
builder.Host = "unsure-tamarin-8005.8nj....";
builder.Database = "...";
builder.Port = 26257;

In the next step you can then connect to the database and bind it to List & Label:

NpgsqlConnection connection = new NpgsqlConnection(builder.ConnectionString);
NpgsqlConnectionDataProvider provider = new NpgsqlConnectionDataProvider(connection);

using (ListLabel LL = new ListLabel())
{
    LL.DataSource = provider;
    LL.Design();
}

After that, all tables along with their relations are available in the designer.

The code uses the NpgsqlConnectionDataProvider, which is provided as a separate NuGet package.

Similarly, the data can also be included in the Report Server, for this you can simply add a PostgreSQL data source and use a connection string of the following type:

Host=unsure-tamarin-8005.8nj....;Username=...;Password=...;Database=...;Port=26257
1 Like