Assigning datasession

Stimulsoft Reports.NET discussion
Post Reply
H-Tech
Posts: 3
Joined: Mon Jul 01, 2013 5:58 pm

Assigning datasession

Post by H-Tech »

I am using the Demo version of the Reports.Net to determine if this product will work to replace an old version of Crystal Reports. Unfortunately, I am not able to get the data to show when the ASP.NET page is run. In the Design Preview mode, the data shows on the report.

I tried the 2013.1 release and now trying the beta 2013.2.1611 release.
System parameters: Development computer is Win 7 Ultimate, MS SQL Server 2008, Visual Studio 2012 Update 2. Everything is running on this computer for testing (no outside server).

On the asp.net page, I have added:
1) asp:SqlDataSource - This pulls the data from a SQL stored procedure
2) cc1:StiWebReport - I created the report and the data shows when in the Design Preview
3) cc1:StiWebViewer - The viewer shows the report (header, footer, etc) but does not show any data..

I do not want to create new connections on each report I create when I can use the existing stored procedures within a SqlDataSource that ASP.Net provides.

Attached are snapshots of the ASP.Net code, Code Behind, Design Preview (showing data) and the view when running the web page. Notice the web page shows the report but no data.

If I am not able to get this working soon, I will not be able to recommend this product to replace CR.
Any help would be appreciated. Thanks.

Michael
Attachments
Web View.jpg
Web View.jpg (24.29 KiB) Viewed 3207 times
Design mode.jpg
Design mode.jpg (146.91 KiB) Viewed 3207 times
Behind Code in VB.jpg
Behind Code in VB.jpg (71.14 KiB) Viewed 3207 times
web page code
web page code
asp net code.jpg (136.06 KiB) Viewed 3207 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Assigning datasession

Post by HighAley »

Hello.

How do you create connection in the WinForms Designer?
If you create there a new SQL connection and add a data source as on the Creating Report in Web with Data from SQL Server video then you don't need bind data to the report.
Other way you could try to use next code to get data:

Code: Select all

SqlConnection conn = new SqlConnection();
SqlDataAdapter da = new SqlDataAdapter("select * from DS1", conn);
DataTable dataTableDS1 = new DataTable();
conn.Open();
da.Fill(dataTableDS1);

StiSqlSource DS1 = new StiSqlSource("Connection", "DS1", "DS1", "SELECT * FROM DS1", true, false);
foreach (DataColumn col in dataTableDS1.Columns)
{
    DS1.Columns.Add(col.ColumnName, col.DataType);
}
Thank you.
H-Tech
Posts: 3
Joined: Mon Jul 01, 2013 5:58 pm

Re: Assigning datasession

Post by H-Tech »

As the original snapshot shows, the SqlDatSource is created to pull a Stored Procedure:
<asp:SqlDataSource ID="SqlDsCbgSuppliers" runat="server" ConnectionString="<%$ ConnectionStrings:connDWM %>" SelectCommand="Rpt_CBG_Suppliers" SelectCommandType="StoredProcedure"></asp:SqlDataSource>


And then that data source is assigned to the report:
<cc1:StiWebReport ID="StiRpt" runat="server" ReportDataSources="SqlDsCbgSuppliers" ...


This works when viewing the report in the Design Preview.

Adding a connection string to every report (as in the video example you provide) is a very poor practice. The maintenance on this would be overbearing. Simply moving the report from the development computer to production server would require each report to be updated. Or if SQL login or passwords need to be changed, all reports would need to be edited. That is not a good solution.

The second option is no better. Having to manually add each field to the data source is very crude.

I don’t understand why the SqlDataSource works in the design of the report and the data shows fine in the Design Preview, but the data will not show when you run the asp.net page.

The SqlDataSource is the best solution because the SQL connection is located on only one location – the web.config.

I am amazed that no one is using SqlDataSource to pull the data into the report. Or that no one has encountered this issue.
Thanks for your help.

Enjoy,
Michael
H-Tech
Posts: 3
Joined: Mon Jul 01, 2013 5:58 pm

Re: Assigning datasession

Post by H-Tech »

OK, I just made a discovery. The original site uses Master Pages. I just created the same page and report, but without the Master Page. And IT WORKS. I can see the data in the Design Preview AND when I run the asp.net page. YEAH!

So does this report engine not work with Master Pages? Or are there different settings that need to be applied either to the Master Page or to the page that contains the report?
Thanks again for your help.

Enjoy,
Michael
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Assigning datasession

Post by Andrew »

Hello,

Thank you for writing.

WebViewer must work with Master Pages. We will investigate this issue and let you know about the results.

Thank you.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Assigning datasession

Post by Vladimir »

Hello,

We tested the work with the Master Page and found no errors. Please send us a test project that would analyze the problem more.

Thank you.
Post Reply