C#2010 Windows应用程序上的映像更新错误 [英] Image updating error on C# 2010 windows application

查看:71
本文介绍了C#2010 Windows应用程序上的映像更新错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c#2010创建Windows应用程序,这里我上传了产品详细信息的图像但是出现了以下错误。如何解决这个错误任何一个给我的想法。



I am creating windows application using c# 2010, here i am upload a image for products details but below error is came. how to solve this error any one give me ideas.

Unable to cast object of type 'System.Drawing.Bitmap' to type 'System.IConvertible'.

 cmd2.Parameters.AddWithValue("@imgmodel", Convert.ToByte(pictureBox1.Image));





我尝试过:





What I have tried:

Image updating error on c# 2010 windows application 

推荐答案

你不能将Bitmap对象转换为任何东西。



你必须创建一个MemoryStream对象并且保存位图到它。然后你可以从MemoryStream中获取字节数组。



但是,你已经被告知了这一点,这里 [ ^ ]。尽量不要忽略下次给出的答案。
You can't "convert" a Bitmap object to anything.

You have to create a MemoryStream object and "save" the bitmap to it. You can then get the array of bytes from the MemoryStream.

But, you've already been told this, here[^]. Try not to ignore the answers you're given next time.


这篇关于C#2010 Windows应用程序上的映像更新错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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