I have used stored procedure that takes parameter for Crystal report but i have used it in WPF
by the way the procedure wii be same in Winfrom also.here goes the procedure i have followed
1) new .rpt file and open Field Explorer then Database Expert there you select your database under that the storedprocedure(input parameters) you want to bind and set storedprocedure parameter as null and click okay.
2)Here am using the Crystalreportviewer in Report.xaml as show below
<Window x:Class="App.Report"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:my="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
Title="Report" Height="969" Width="944" Loaded="Window_Loaded">
<Grid>
<my:CrystalReportsViewer Name="crystalreportviewer" IsManipulationEnabled="True"></my:CrystalReportsViewer>
</Grid>
</Window>
used the below method for
private void GenerateReport(DateTime Fromdate, DateTime Todate, Int64 mobNo, string rptName)
{
Report rpt = new Report();
rpt.Show();
ReportDocument report = new ReportDocument();
report.Load("" + GetCurrentPath()[0] + "Reports\\" + rptName + "");
report.SetDatabaseLogon("sa", "password");
report.SetParameterValue("@Fromdate", Fromdate);
report.SetParameterValue("@Todate", Todate);
rpt.crystalreportviewer.ViewerCore.ReportSource = report;
}
My required stored procedure contains two parameters.Hope this would be helpful.