I am trying to display the varbinary data on a crystal report after converting it to original bytes. The content that I saved is a pdf content. I followed this approach to achieve as per my requirement
http://csharpdotnetfreak.blogspot.com/2012/06/crystal-reports-display-images-database.html
My code is as follows
- SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString);
- string strSelect = "SELECT FileData from Documents where ID = 26";
- SqlCommand cmd = new SqlCommand(strSelect, con);
- SqlDataAdapter dAdapter = new SqlDataAdapter(cmd);
- con.Open();
- dAdapter.Fill(dsReport.Tables["Documents"]);
- Byte[] bytes = (Byte[])dsReport.Tables[0].Rows[0]["FileData"];
- dsReport.Tables[0].Rows[0]["FileData"] = bytes;
- dsReport.AcceptChanges();
- con.Close();
- CrystalReport1 rpt = new CrystalReport1();
- rpt.SetDataSource(dsReport);
- crystalReportViewer1.ReportSource = rpt;
So can some one help me how can I display byte[] data on to the report