Assigning datasession
Assigning datasession
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
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 (24.29 KiB) Viewed 3202 times
-
- Design mode.jpg (146.91 KiB) Viewed 3202 times
-
- Behind Code in VB.jpg (71.14 KiB) Viewed 3202 times
-
- web page code
- asp net code.jpg (136.06 KiB) Viewed 3202 times
Re: Assigning datasession
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:
Thank you.
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);
}
Re: Assigning datasession
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
<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
Re: Assigning datasession
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
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
Re: Assigning datasession
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.
Thank you for writing.
WebViewer must work with Master Pages. We will investigate this issue and let you know about the results.
Thank you.
Re: Assigning datasession
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.
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.