I have checked stackoverflow, google, youtube, msdn resources. MSDN says, I need to use picturebox and use my database and set mime type. I've done this. But Image does not show.
How can I show any type of image i.e jpg, png etc from database to Microsoft Report RDLC? I've saved image into database as binary type.
ReportViewer.cs:
_connection.Open();
_aPatient = new Patient();
String QuearString = String.Format(
"SELECT ImageReportStorageTable.ImageOne From ImageReportStorageTable " +
" WHERE (ImageReportStorageTable.PrescriptionCode = 21)");
String baseString=null;
_command = new SqlCommand(QuearString, _connection);
SqlDataReader aReader = _command.ExecuteReader();
if (aReader.HasRows)
{
while (aReader.Read())
{
baseString = Convert.ToBase64String((byte[]) (aReader[0]));
}
}
_connection.Close();
ReportParameter paramLogo = new ReportParameter();
paramLogo.Name = "Image1";
paramLogo.Values.Add(baseString);
prescriptionReportViewer.LocalReport.SetParameters(paramLogo);
I've used the returned value from the query above into report viewer image property function.
=System.Convert.FromBase64String(Parameters!Image1.Value)