Use external images or database images in reports
By default, external images cannot be used in reportviewer reports. To use an external image, you mustCodeSet inEnableexternalimagesAttribute. To see how to specify an external image example, seeExample: Use RSS source in reportviewer.
To use database images, you can specify the database fields that contain images when the MIME type is JPG, PNG, or BMP. If an image is stored as a binary object, you must write an expression to convert the image to a supported type.
The processing process of the field [ImagePath] is to read the image with stream before binding, convert it to the byte [] array, and finally convert itBase64string, and then bind
// Strem numeric Dataset
Public static byte [] streamtobytes (Stream stream) {byte [] bytes = new byte [stream. length]; If (stream. canread) {stream. read (bytes, 0, (INT) stream. length);} stream. close (); Return bytes;
}
In the report rdlc. Drag and Drop an image control in the report body. Set its source to database,Value = system. Convert. frombase64string (Fields! Barcode. Value) [byte [] array], which can be directly bound to the base64string type. // Key.
Set the mimetype attribute. In this way, your images can be dynamically displayed in the report.