combit List & Label 24 - .NET Online Web Help
Passing the Datasource
Programming Introduction > Tutorial > Fundamentals > Passing the Datasource

A very important step is to tell List & Label which data should be used for reporting. The data to be used cannot simply be selected later by the user directly via List & Label. This must have been realized via the application itself beforehand. This has decisive advantages, since, for example, the rights management of the application can be taken into account and, if necessary, any drivers for the data access itself only have to be loaded once. It is therefore important to know where and in what technical form the data to be used can be made available for reporting in the application. The List & Label databinding already provides a variety of different data providers, which can be used in the simplest way.

  1. First reference the namespace combit.ListLabel24.DataProviders
  2. Then the appropriate data provider with its settings and options can be created
  3. Finally, you can pass the created data provider to the List & Label object (ListLabel) using the DataSource property
// 1. Add namespace for data providers
using combit.ListLabel[Versionsnummer].DataProviders;

...

// 2. Create suitable dataprovider - e.g. for accessing a Microsoft SQL Server database
SqlConnection connection = new SqlConnection(Properties.Settings.Default.ConnectionString);
SqlConnectionDataProvider sqlProvider = new SqlConnectionDataProvider(connection);

...

// 3. Attach the created data provider to the List & Label object
LL.DataSource = sqlProvider;
' 1. Add namespace for data providers
Imports combit.ListLabel[Versionsnummer].DataProviders

...

' 2. Create suitable dataprovider - e.g. for accessing a Microsoft SQL Server database
Dim connection As New SqlConnection(Properties.Settings.Default.ConnectionString)
Dim sqlProvider As New SqlConnectionDataProvider(connection)

...

' 3. Attach the created data provider to the List & Label object
LL.DataSource = sqlProvider
 

Hint: A detailed overview of the data providers already included can be found in the namespace DataProviders.

Tip: If no suitable data provider is available, you can also create your own data provider using the IDataProvider interface.

   

Of course, the data registered can be influenced or additional data from other sources can be added. Further information can be found in these examples: