且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将图像添加到图像列表时出现内存不足异常

更新时间:2023-01-14 15:18:02

首先,并非文件夹中的所有文件都是图像,并且您试图将不是图像文件的文件加载到

First, not all files in your folder are images and you are attempting to load a file that is not an image file into

this.imageList1.Images.Add(Image.FromFile(file.FullName));



抛出file.FullName OutOfMemory异常中包含的字符串.

请参阅验证文件为JPEG的解决方案二 [



The the string contained in file.FullName an OutOfMemory Exception is thrown.

See solution two of Verifying a file is JPEG[^] on how to pick certain image files from a directory.


在.aspx中,您可以这样做:-

In .aspx u can do like this : -

<itemtemplate>
<img src="<%# Eval("path") %>" />
</itemtemplate>




或尝试以下方法:- http://www.c-sharpcorner.com/uploadfile/e628d9/inserting-retrieving-images-from-sql-server-database-without-using-stored-procedures/ [




or try this one :- http://www.c-sharpcorner.com/uploadfile/e628d9/inserting-retrieving-images-from-sql-server-database-without-using-stored-procedures/[^]