SqlDataSource With Select Parameters
Hi,
I m trying to use fast report with SqlDataSource object in my ASP.NET project.
When i use SqlDataSource without select parameters, it works. But when i add some select parameters
i get the error below..
some code and stack trace ;
<cc1:WebReport ID="WebReport1" runat="server" ReportDataSources="SqlDataSource1" ReportFile="~/Reports/CRM/Order.frx" ReportResourceString="" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="server=MYSERVER;Initial Catalog=MYDB;uid=MyUser;pwd=MyPass"
SelectCommand="SELECT * FROM [dbo].[vwOrders] WHERE ((@CustomerId IS NULL) OR (CustomerId = @CustomerId)) AND ((@OrderStatus IS NULL) OR (OrderStatus = @OrderStatus)) ">
<SelectParameters>
<asp:QueryStringParameter Name="CustomerId" QueryStringField="customer" Type="Int32" />
<asp:QueryStringParameter Name="OrderStatus" QueryStringField="status" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at FastReport.Data.Dictionary.HWRMrgXZv(IEnumerable , String , Int32 , Boolean )
at FastReport.Report.UKsHxDq6u(IEnumerable , String )
at FastReport.Report.mgb3BywHV(IEnumerable )
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at FastReport.Report.RegisterDataAsp(IDataSource data, String name)
at FastReport.Web.WebReport.MQSObcjjN(Report )
at FastReport.Web.WebReport.1fZfqDsN7()
at FastReport.Web.WebReport.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.reports_crm_rptorderstatus_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mrpweb\9638b2f6\7b3096aa\App_Web_do-pfecj.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I m using a custom filter for my web application's report screen.. How can i solve this error?
thanks in advance..
not : i just using latest demo version..
I m trying to use fast report with SqlDataSource object in my ASP.NET project.
When i use SqlDataSource without select parameters, it works. But when i add some select parameters
i get the error below..
some code and stack trace ;
<cc1:WebReport ID="WebReport1" runat="server" ReportDataSources="SqlDataSource1" ReportFile="~/Reports/CRM/Order.frx" ReportResourceString="" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="server=MYSERVER;Initial Catalog=MYDB;uid=MyUser;pwd=MyPass"
SelectCommand="SELECT * FROM [dbo].[vwOrders] WHERE ((@CustomerId IS NULL) OR (CustomerId = @CustomerId)) AND ((@OrderStatus IS NULL) OR (OrderStatus = @OrderStatus)) ">
<SelectParameters>
<asp:QueryStringParameter Name="CustomerId" QueryStringField="customer" Type="Int32" />
<asp:QueryStringParameter Name="OrderStatus" QueryStringField="status" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at FastReport.Data.Dictionary.HWRMrgXZv(IEnumerable , String , Int32 , Boolean )
at FastReport.Report.UKsHxDq6u(IEnumerable , String )
at FastReport.Report.mgb3BywHV(IEnumerable )
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at FastReport.Report.RegisterDataAsp(IDataSource data, String name)
at FastReport.Web.WebReport.MQSObcjjN(Report )
at FastReport.Web.WebReport.1fZfqDsN7()
at FastReport.Web.WebReport.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.reports_crm_rptorderstatus_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\mrpweb\9638b2f6\7b3096aa\App_Web_do-pfecj.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I m using a custom filter for my web application's report screen.. How can i solve this error?
thanks in advance..
not : i just using latest demo version..
Comments
This can happen if you did not set the parameter value before generating a report. Could you send me an example project?
tz@fast-report.com
hi Alex..
i send a sample asp.net project to your email..
any suggestion?
Since I can't test your example, I made my own. On the main form (Default.aspx) I have a hyperlink that calls another form, WebForm1.aspx. In that form, I have SqlDataSource and WebReport. The hyperlink url that calls the WebForm1, contains parameters:
and SqlDataSource on the WebForm1 uses it:
Everything works fine. If I don't include parameter in an url, I will get an error just like your.
thanks Alex..