I get this error
The types of the parameter field and parameter field current values are not compatible.
when passing both database and parameter to Crystal Reports.
ReportDocument rd = new ReportDocument();
public string user;
public frmReport(string User)
{
InitializeComponent();
loadReport();
this.user = User;
}
public void loadReport()
{
rd.Load(@"C:\Users\Jeff Enad\Desktop\TEST1\Cebu Hallmark Hotel Management System\Cebu Hallmark Hotel Management System\cryReport.rpt");
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=dbCebuHallmark;Integrated Security=True");
SqlDataAdapter da = new SqlDataAdapter("GetAllReport", con);
rd.SetParameterValue("UserPrinted", user); //This is the parameter
da.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new System.Data.DataSet();
da.Fill(ds, "REPORT");
rd.SetDataSource(ds);
crystalReportViewer1.ReportSource = rd;
crystalReportViewer1.Refresh();
}
The SetParameterValue() is causing the error.
Can anyone help me to solve this problem? Should I add parameter in stored procedure or in dataset?
I just want to pass the user's name to the Crystal Report that has database.
