将longblob转换为整数时出错... [英] Error on conversion longblob into integer...

查看:84
本文介绍了将longblob转换为整数时出错...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mysql后端的c#winapp中有一个严重的问题...实际上我正在使用filestreme将图像保存到数据库中,并转换为二进制格式并成功运行,但是在从数据库中检索图像时保存之后(MySql Longblob)通过此代码"int filesize = data.GetInt32(data.GetOrdinal(列名"));(数据是mysqldatareader的对象)出现错误,例如"对象必须实现IConvertible.并且发生了无效的Cast异常"... ......任何人都可以帮助我……明天是项目的决策,对我来说这是错误的错误……所以plz help

解决方案

"columne name"包含大小的列吗?为什么要用data.GetInt32(data.GetOrdinal("columne name"))而不是data.GetInt32("columne name")? GetInt64 也许可以解决问题.
如果"columne name"包含图像,则可以在查询中使用OCTET_LENGTH函数来检索其长度:

  SELECT  OCTET_LENGTH(" )位置 .... 


i have a crictical problam in c# winapp with mysql backend...Actually i am saving image in database using filestreme with the conversion into binary format and its successfully running but after saving when i am retriving it from database(MySql Longblob) by this code "int filesize = data.GetInt32(data.GetOrdinal("columne name"));(data is object of mysqldatareader)" there is error like "Object must implement IConvertible. and Invalid Cast Exception was cought".........can anyone help me......tommrow is ma project submision and its erreting error for me......so plz help

解决方案

Is "columne name" the column containing the size? And why do you a data.GetInt32(data.GetOrdinal("columne name")) instead of data.GetInt32("columne name")? Perhaps a GetInt64 would do the trick.
In case that "columne name" contains the image, you could use the OCTET_LENGTH function in a query to retrieve its length:

SELECT OCTET_LENGTH("columne name") FROM YOURTABLE WHERE ....


这篇关于将longblob转换为整数时出错...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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