title: How to display image from database on RDLC report
body: <p>My RDLC Design:</p>
  
  <p><a href="https://i.stack.imgur.com/L6Z3M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L6Z3M.png" alt="http://imgur.com/a/dglzS"></a></p>
  
  <p>I want to show image on my report Viewer from my database my reportviewer is working fine I just need an image for each selection and I have already images in my database for each patient I just want to show that here in my .aspx page I also attached the code below.</p>
  
  <p>My Aspx page:</p>
  
  <pre><code>&lt;body &gt;
   &lt;form id="form1" runat="server"&gt;
      &lt;div class="auto-style1"&gt;
        &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;
          &lt;/asp:ScriptManager&gt;
            &lt;table class="auto-style2"&gt;
              &lt;tr&gt;
                &lt;td class="auto-style5"&gt;  &amp;nbsp;&amp;nbsp;
               &lt;asp:Label ID="Label1" runat="server" CssClass="auto-style4" 
             Text="Patient Report"&gt;&lt;/asp:Label&gt;
         &lt;asp:DropDownList ID="DropDownPat" runat="server" Height="16px"  
    Width="157px" AutoPostBack="True" 
   OnSelectedIndexChanged="DropDownPat_SelectedIndexChanged"&gt;
   &lt;asp:ListItem&gt;&lt;/asp:ListItem&gt;
   &lt;/asp:DropDownList&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
     &lt;td class="auto-style3"&gt;
       &lt;rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="205px" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="751px"&gt;
         &lt;LocalReport ReportPath="Report1.rdlc"&gt;
           &lt;DataSources&gt;
              &lt;rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" /&gt;
          &lt;/DataSources&gt;
         &lt;/LocalReport&gt;
        &lt;/rsweb:ReportViewer&gt;
       &lt;asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="MedImage.DataSet1TableAdapters.DataTable1TableAdapter"&gt;&lt;/asp:ObjectDataSource&gt;
            &lt;/td&gt;
           &lt;/tr&gt;            
          &lt;/table&gt;    
      &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>My .cs file:
  I want to show image on report viewer from my database</p>
  
  <p>Code behind aspx page are here</p>
  
  <pre><code>public partial class PatientReport : System.Web.UI.Page
      {
          protected void Page_Load(object sender, EventArgs e)
          {                
              if (!IsPostBack)
              {             
                  populateDropDownPat();
              }
          } 
          private void populateDropDownPat()
          {
            try
              {
               patientCollection pcal = (new patientBAL()).GetAllDetailspatient();
                  DropDownPat.DataSource = null;
                  DropDownPat.DataSource = pcal;
                  DropDownPat.DataTextField = "patientName";
                  DropDownPat.DataValueField = "PatientID";
                  DropDownPat.DataBind();
                  DropDownPat.Items.Insert(0, new ListItem("--Select Patient--"));
              }
              catch(Exception ex)
              {
              }        
          }
       protected void DropDownPat_SelectedIndexChanged(object sender, EventArgs e)
          {
            string name = DropDownPat.SelectedItem.Text;
            patientCollection pcal = (new 
            patientBAL()).GetDetailsByPatientName(name);
            ReportViewer1.Visible = true;
            this.ReportViewer1.LocalReport.EnableExternalImages = true;
            this.ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportDataSource rds = new ReportDataSource("DataSet1", pcal);
            this.ReportViewer1.LocalReport.DataSources.Add(rds);
           this.ReportViewer1.LocalReport.Refresh(); 
          }
      }
  </code></pre>