What I done for parameters is created a MulitView page that has the Crystal view in view2. View1 has 2 Calendar controls for the user to select the date and a button to run the report. This removes the "Opps I put the date in wrong".
code behind
public partial class Vehicle_Reports_RepairsByVIN : System.Web.UI.Page
{
ReportDocument MainRpt = new ReportDocument();
protected void Page_Load(object sender, EventArgs e)
{
if (mvMain.ActiveViewIndex == 1)
Report_Load();
}
protected void Page_UnLoad(object sender, EventArgs e)
{
MainRpt.Close();
}
protected void Report_Load()
{
MainRpt.Load(Server.MapPath("RepairsByVIN.rpt"));
string StartDate = CalStart.SelectedDate.ToShortDateString();
string EndDate = CalEnd.SelectedDate.ToShortDateString();
MainRpt.SetParameterValue("StartDate", StartDate);
MainRpt.SetParameterValue("EndDate", EndDate);
MainRpt.SetDatabaseLogon("user", "userpassword", "SQLServer", "DBName");
CrvReportViewer.ReportSource = MainRpt;
}
protected void BtnRunReport_Click(object sender, EventArgs e)
{
if (CalStart.SelectedDate < CalEnd.SelectedDate)
{
mvMain.ActiveViewIndex = 1;
Report_Load();
}
else
lblError.Text = "Please Choose a Start Date before a End Date.";
}