Display Image in RDLC Report (Microsoft Report Viewer)

Browse Image and Read it into Binary Format


Read into Binary Format






int len = FileUpload1.PostedFile.ContentLength;
byte[] pic = new byte[len];
FileUpload1.PostedFile.InputStream.Read(pic, 0, len); 

Step 1. Add one Dataset







Step 2. Add Report.rdlc file in project  go to Report and change the property
     
  
Now Display Save Image into RDLC report (Microsoft Report Viewer)





using (SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.
AppSettings["Connection"].ToString()))
           {
                cn.Open();
                using (SqlCommand cmd = new SqlCommand("select Picture,Name,ID from tblImage", cn))
                {
                    
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        DataSet ds = new DataSet();
                        da.Fill(ds, "DataSet1_DataTable1");
                        ReportDataSource rds = new ReportDataSource("DataSet1_DataTable1", ds.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportViewer1.LocalReport.DataSources.Add(rds);
                        ReportViewer1.LocalReport.Refresh();
                                            
                    }
                
                }
         }




Display Image in RDLC Report (Microsoft Report Viewer) Display Image in RDLC Report (Microsoft Report Viewer) Reviewed by vishal on 11:01 AM Rating: 5