如何直接从图片框将图像插入数据库 [英] how to insert an image into database directly from picturebox

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

问题描述

我有一个扫描设备,它使我可以捕获图像并将其存储到图片框中而无需从硬盘读取,我希望能够直接从图片框中将图像插入数据库中而无需从指定路径读取图像
任何代码示例?

谢谢

i have a scanning device which makes me can capture an image and store it into picture box without reading from hard disk, i want to be able to insert the image into database directly from the picturebox without reading it from a specified path
any sample of code ?

Thanks

推荐答案

private static void SavePictureBoxToDatabase(PictureBox myPictureBox)
    {
    MemoryStream ms = new MemoryStream();
    myPictureBox.Image.Save(ms, ImageFormat.Jpeg);
    ms.Seek(0, 0);
    WriteToMyDatabase(ms.GetBuffer());
    }

很显然,您必须编写WriteToMyDatabase方法,因为我们不知道您要处理的是哪种数据库类型...

Obviously, you have to write the WriteToMyDatabase method since we don''t know what database type you are dealing with...


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

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