如何使用表格内的图像控件动态显示图像?
我有以下
并且我想在表格内使用图像控件动态显示图像.这是我试过的
and I would like to display the images using Image control inside a table dynamically. This is what I have tried
但结果是
所以有两件事要做
a) 可以看出我选择了 Mime Type 作为images/png"(png 中的第一个图像).它也可以是图像/jpge 或/png 的混合
a) As can be figured out that I have chosen Mime Type as "images/png" (first image in png). It can be a mix of images/jpge or /png also
b) 为什么图像不显示?我哪里出错了?
b) Why the images are not displaying ? where I am going wrong ?
表架构如下所示
create table tblImageTest(Id int, EmployeeName varchar(100), CancellationImage varchar(100))
insert into tblImageTest values(1, 'emp1','1.PNG')
insert into tblImageTest values(2, 'emp2','2.jpg')
insert into tblImageTest values(3, 'emp3','3.jpg')
insert into tblImageTest values(4, 'emp4','4.jpg')
还有存储过程
alter procedure usp_imagetest
as
begin
select *,CancellationImagePath = 'F:\imagefolder\' + CancellationImage
from tblImageTest
end
注意~ 我们不能将图像作为 Blob 存储在数据库中.这是限制.只有图像路径可用.
编辑
这是我部署到浏览器后的结果
This is the result after I deployed in browser
我刚刚在本地试过了.
b) 为什么图像不显示?我哪里出错了?
我认为您不必选择数据库作为图像源,而是外部原因.
I think you don't have to select Database as Image source rather External reason.
您必须在图片路径前添加 file://.
You will have to add file:// in front of your Image path.
原因:
这取决于图像字段中的值.如果是VARBINARY(MAX)数据类型值,那么我们可以选择Database作为图片Source.如果是图片URL的字符串,那么我们应该选择External作为图片来源.
It depends on the value in the Image field. If it is a VARBINARY(MAX) data type value, then we can select Database as the image Source. If it is a string of the image URL, then we should select External as the image Source.