Report Data and SqlDataSource

edited December 2009 in FastReport .NET
Hi,

I m designing report in FR designer and i m adding a data source to report. then i use a view from report data.
Than i save report file for use in my web application.
In web page, i use a sqldatasource that uses a stored procedure with parameters.. this stored procedure uses view above that i used in report data..
And stored procedure expects 4 parameters to filter views data..
And i m running report page and the report gets all data, because there is no filter..
As yet, everything is ok.
but when i select some filter option from my custom filter and load report with these filter options, report does not get right data..
All data in the report like no filter..
And i open the Sql Profiler to see what is working back side and i see the problem;
Firstly sqldatasource's stored procedure works 2 times
Secondly reports data view works and report show all data..

Question: Why report does not use sqldatasource's storedprocedure instead of report's data view? where is the mistake?

Some Code:

<cc1:WebReport ID="WebReport1" runat="server" ReportDataSources="SqlDataSource1" OnStartReport="WebReport1_StartReport"
ReportFile="~/Reports/Stock/StockTransactions.frx" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="" SelectCommand="spStockTransactions"
SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter Name="ItemId" QueryStringField="item" Type="Int32" />
<asp:QueryStringParameter Name="Type" QueryStringField="trans" Type="string" />
<asp:QueryStringParameter Name="Date1" QueryStringField="date1" Type="DateTime" />
<asp:QueryStringParameter Name="Date2" QueryStringField="date2" Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>

code behind;

protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.ConnectionString = Erciyes.Data.SqlHelper.ConnectionStringReportTransaction;
}
protected void WebReport1_StartReport(object sender, EventArgs e)
{
WebReport1.Report.Dictionary.Connections[0].ConnectionString = Erciyes.Data.SqlHelper.ConnectionStringReportTransaction;
WebReport1.Report.RegisterData(((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).Table, SqlDataSource1.ID);
}

thanks in advance..

Comments

  • edited 8:04PM
    hi again,

    i find a solution but i think it is not best..

    i open the report designer and delete my added data source..
    than i changed field name to vwStockHistories.ItemId to SqlDataSource1.ItemId
    Set Data name to SqlDataSource1 (if not there is 1 row in report)
    Save and close..

    Than i run report, it works..
  • edited 8:04PM
    Hello,

    I'd like to look at the report file (.frx). Could you send it to my email (tz@fast-report.com)?
  • edited 8:04PM
    Hi Alex,

    i sent you the report file..

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.