Dorababu Meka

Dorababu Meka

  • 215
  • 8.3k
  • 1.7m

Crystal report displaying varbinary(MAX) on the report

Sep 25 2016 2:16 AM
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
 
  1. SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString);  
  2. string strSelect = "SELECT FileData from Documents where ID = 26";  
  3. SqlCommand cmd = new SqlCommand(strSelect, con);  
  4. SqlDataAdapter dAdapter = new SqlDataAdapter(cmd);  
  5. con.Open();  
  6. dAdapter.Fill(dsReport.Tables["Documents"]);  
  7. Byte[] bytes = (Byte[])dsReport.Tables[0].Rows[0]["FileData"];  
  8. dsReport.Tables[0].Rows[0]["FileData"] = bytes;  
  9. dsReport.AcceptChanges();  
  10. con.Close();  
  11.  CrystalReport1 rpt = new CrystalReport1();  
  12.  rpt.SetDataSource(dsReport);  
  13.  crystalReportViewer1.ReportSource = rpt;  
 So can some one help me how can I display byte[] data on to the report  

Answers (3)