如何从数据库中检索图像 [英] how to retrieve images from database

查看:60
本文介绍了如何从数据库中检索图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从数据库中检索图像并保存到文件夹中(在项目中或在计算机中)我在数据库中以字节的形式存在10000多个图像。

解决方案

只需选择它们,然后将返回的值转换为字节数组。

然后你就可以使用 File.WriteAllBytes [ ^ ]创建具有相应扩展名的文件的方法。



对于这个数量的图像,我可能会使用DataReader而不是DataAdapter来节省内存,并且在BackgroundWorker中执行任务,因为这将是一个耗时的过程。

how to retrieve images from database and save into a folder (with in project or in computer) i have more than 10000 images in database in the form of bytes.

解决方案

Just SELECT them, and cast the returned value into an array of bytes.
You can then just use File.WriteAllBytes[^] method to create a file with the appropriate extension.

For that number of images, I'd probably use a DataReader rather than a DataAdapter for save memory, and do the task in a BackgroundWorker as it's going to be a time consuming process.


这篇关于如何从数据库中检索图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆