如何直接从Picturebox控件存储图像没有任何文件名以及文件位置.....因为我M在Picturebox中显示创建的位图图像..... [英] How To Store Image Directly From Picturebox Control Without Any File Name As Well As File Location.....Beacause I M Showing A Created Bitmap Image In Picturebox.....

查看:148
本文介绍了如何直接从Picturebox控件存储图像没有任何文件名以及文件位置.....因为我M在Picturebox中显示创建的位图图像.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将文本转换为图像.....其中我成功创建了位图.....但是我无法在数据库中存储数据类型图像.....我为不同的图像获取相同的位在tresulted数据库.... plz帮助我尽快

i m converting text to image.....in which i m succesfully created the bitmap.....but m not able to store in database with datatype image.....I m getting the same bits for different images in tresulted database....plz help me out as soon as possible

推荐答案

将图像存储在数据库中,您需要将其转换为字节数组:



MemoryStream ms = new MemoryStream();

image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);



然后将ms发送到数据库,如下所示:

ms.ToArray();
to store image in database you need to convert it to array of bytes:

MemoryStream ms = new MemoryStream();
image.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);

then send the ms to database like this:
ms.ToArray();


这篇关于如何直接从Picturebox控件存储图像没有任何文件名以及文件位置.....因为我M在Picturebox中显示创建的位图图像.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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