Display Image in RDLC Report (Microsoft Report Viewer)

Browse Image and Read it into Binary Format

Read into Binary Formate
Select User Image.jpeg
 int len = FileUpload1.PostedFile.ContentLength;
            byte[] pic = new byte[len];
            FileUpload1.PostedFile.InputStream.Read(pic, 0, len); 

1. Add one Dataset

AddDataset.JPG


 2. Add Report.rdlc file in project
     
    go to Report and change the property

 ChangeProperty.JPG



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 imagein rdlc.JPG


Ebook Download
View all
Learn
View all