Direct Access to Data Base

SharpShooter Reports report generator realizes the following concept: data for the report should be provided by the application. It allows the use of any data sources and makes rules of providing data (report template) independent form the certain data source.

But sometimes there is a requirement to strongly bind report template to certain data source, or to provide end user the ability not only to create/edit templates, but add custom data sources.

That is why report template features a collection of built-in data sources – data sourcesset directly for this template (Document.DataSources property). Report designer allows adding and editing such data sources.

Built-in Document Data Source Editor:

Editor is called when you set Document.DataSources property or click “Data Sources” button on the toolbar.

You can set or edit the following data source types in the editor:

 

  • OdbcDataSource to get data from different DBMS via the Open Database Connectivity (ODBC) interface.
  • SqlDataSource to get data from MS SQL.
  • XmlDataSource to get document data.

     

    The use of data sources built-in the document template doesn’t differ from the use of data sources connected from the application. Built-in data sources and their structure (if it is possible to get data from this data source during template design) will be available in the template designer in the data sources tree.

    To get data in the template directly from data base it is possible to use OdbcDataSource or SqlDataSource data source. Their designation and properties are similar; they differ only by the way of connection to DBSM. If you use MS SQL, it is recommended to use SqlDataSource.

    To set OdbcDataSource or SQL SqlDataSource data source you need to set:

     

    • Name property – sets data source name used to refer to data source from a template.
    • ConnectionString property – sets connection string to data source.
    • SelectQuery property – sets SQL query to get data.

       

      To get data in the template directly from XML documents, it is necessary to add XmlDataSource data source, set its properties:

       

      • Name property - sets data source name used to refer to data source from a template.
      • DataFile property – sets path to ХML document
      • XPathproperty – sets initial path (expression on XPath language) applied to XML data.

       

      Add Feedback