保存和检索图像到C#表单 [英] save and retrieve image unto a c# form

查看:85
本文介绍了保存和检索图像到C#表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用c#格式在sql中存储和检索图像.我可以存储
图像进入数据库,但是当我尝试在表格上搜索并显示图像时出现错误消息

在我的保存按钮上,我有

i am trying to store and retrieve an image in sql using c# form. i am able to store
the image into the db but i get an error message when i try to search and display the immage on the form

on my save button i have

var
_with1 = person;
_with1.ID = this.txtClientid.Text;
_with1.myPicture  = imgPerson.Image;




在搜索按钮上,我有

_with3.imgPerson.Image = person.myPicture.ToString();

但我从Serch按钮中收到一条错误消息
无法将类型字符串"隐式转换为"System.Drawing.Image"

请帮助




on the search button i have

_with3.imgPerson.Image = person.myPicture.ToString();

but i get an error message from the serch button
Cannot implicitly convert type ''string'' to ''System.Drawing.Image''

pls help

推荐答案

取消ToString方法调用.
如果person.myPicture是图像,则可以直接使用它.
Take off the ToString method call.
If person.myPicture is an Image, you can use it directly.


这篇关于保存和检索图像到C#表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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