Methoun Ahmed

Methoun Ahmed

  • NA
  • 145
  • 101.9k

An exception of type 'System.Runtime.InteropServices.COMExce

Mar 31 2017 11:54 AM
Here is my code :
 
con.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM tblReport WHERE Date between '"+strDate+"'and'"+endDate+"'",con);
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataTable dt = new DataTable();
da.Fill(dt);
con.Close();
ReportDocument crypt = new ReportDocument();
crypt.Load(@"F:\Project C#\Project ASP.Net\IT Report 2013\IT Application\IT Application\ITReport.rpt");
crypt.DataDefinition.FormulaFields["DateForm"].Text = "'" + strDate.ToString() + "'";
crypt.DataDefinition.FormulaFields["DateTo"].Text = "'" + endDate.ToString() + "'";
crypt.SetDataSource(dt);
CrystalReportViewer1.ReportSource = crypt; 

Answers (1)