Module LabOrion.DisplaySqlData
    Module LabOrion.DisplaySqlData module makes it possible to display table data from an arbitrary Database in the HTML template.
In the module settings, you must specify the provider name, connection string, request type (text, procedure), SQL query, query fields to insert into the template and the HTML template itself, insert fields into square brackets [FieldName].
You can display both a single line selection and many lines by specifying line patterns.
Also, the module has a cache for saving the finished result for a specified time.

To specify a string template, use the tags: <!-- row start -->, <!-- row end -->, <!-- row empty start -->,<!-- row empty end -->

<!-- row start -->
This is a template string in which you must specify the tag fields to replace.
Field tags are field names in the SQL query, they must be specified in the module configuration.
Tags should be placed in square brackets in order to replace them with the results of a SQL query.
Example: [UserId], [UserName]
<!-- row end -->

<!-- row empty start -->
This is the line pattern that will be applied in the case of an empty SQL query result
<!-- row empty end -->

Download module LabOrion.DisplaySqlData

Date Created: 12.11.2017 LabOrion.DisplaySqlData_01.01.01_Install.zip
LabOrion.DisplaySqlData_01.01.01_Source.zip

Tested in DNN 9
Please ask questions here

Example LabOrion.DisplaySqlData
Name Category Description Price
1. Product Name 1 Product Category 1 Product Description 1 10.00
2. Product Name 2 Product Category 2 Product Description 2 20.00
3. Product Name 3 Product Category 3 Product Description 3 30.00
4. Product Name 4 Product Category 4 Product Description 4 40.00
5. Product Name 5 Product Category 5 Product Description 5 50.00
6. Product Name 6 Product Category 6 Product Description 6 60.00
7. Product Name 7 Product Category 7 Product Description 7 70.00
Example module configuration
SQL Provider name: System.Data.SqlClient
SQL Command Type: Text
SQL Connection String: Data Source=(local);Initial Catalog=*****;Integrated Security=True
SQL Command Text: SELECT * FROM dbo.Test_Product
Fields To Replacement: ProductName,ProductCategory,ProductDescription,ProductPrice
Html Template:
<table cellspacing="0" style="border-width:0px;border-style:None;width:100%;border-collapse:collapse;">
<tr>
<th scope="col">Id</th>
<th scope="col">Name</th>
<th scope="col">Category</th>
<th scope="col">Description</th>
<th scope="col">Price</th>
</tr>
<!-- row start -->
<tr style="background-color:#EFF3FB;">
<td align="right">[RowNumber].</td>
        <td align="right">[ProductName]</td>
<td align="right">[ProductCategory]</td>
<td align="right">[ProductDescription]</td>
<td align="right">[ProductPrice]</td>
</tr>
<!-- row end -->
<!-- row start -->
<tr style="background-color:White;">
<td align="right">[RowNumber].</td>
        <td align="right">[ProductName]</td>
<td align="right">[ProductCategory]</td>
<td align="right">[ProductDescription]</td>
<td align="right">[ProductPrice]</td>
</tr>
<!-- row end -->
<!-- row start -->
<tr style="background-color:#EEDD23;">
<td align="right">[RowNumber].</td>
        <td align="right">[ProductName]</td>
<td align="right">[ProductCategory]</td>
<td align="right">[ProductDescription]</td>
<td align="right">[ProductPrice]</td>
</tr>
<!-- row end -->
    <!-- row empty start -->
<tr style="background-color:#EFF3FB;">
<td colspan='5' align='center'>
Empty
    </td>
</tr>
<!-- row empty end -->

</table>

Table

CREATE TABLE dbo.Test_Product   (
ProductId int IDENTITY(1,1) PRIMARY KEY, 
      ProductName nvarchar(255) NOT NULL, 
     ProductCategory nvarchar(255) NULL,
ProductDescription text NULL,
     ProductPrice decimal(19,2) NULL  )  
GO 

INSERT INTO dbo.Test_Product (ProductName, ProductCategory, ProductDescription, ProductPrice)
VALUES 
('Product Name 1','Product Category 1','Product Description 1', 10),
('Product Name 2','Product Category 2','Product Description 2', 20),
('Product Name 3','Product Category 3','Product Description 3', 30),
('Product Name 4','Product Category 4','Product Description 4', 40),
('Product Name 5','Product Category 5','Product Description 5', 50),
('Product Name 6','Product Category 6','Product Description 6', 60),
('Product Name 7','Product Category 7','Product Description 7', 70)


Copyright 2010 by Kirill Shurevich - LabOrion
Privacy Statement Terms Of Use