fileupload插入错误 [英] fileupload insertion error

查看:94
本文介绍了fileupload插入错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,



请帮我这个,我有这个错误,当我试图在我的fileupload中插入一个文件。然后它会提示一些东西,下面是我写的代码,错误信息是粗体。我用于productimg列的数据类型是image。



row [prodcutimg] = Fileuploadd1.FileName.ToString(); ----值类型与列类型不匹配无法存储< picture002,jpg>在productimg专栏中。预期类型是Byte []

解决方案

错误消息非常明确:它需要一个字节数组,并且您正在传递一个字符串。 />
如果你想传递文件内容,那么你无论如何都做错了:它只传递文件的名称,而不是文件包含的实际数据。

尝试:

  byte  [] filedata = Fileuploadd1.FileBytes; 
行[ prodcutimg] = filedata;


Guys,

please help me with this, im having this error, when im trying to insert a file in my fileupload. It then prompts something, below is the code i wrote and the error message is on bold. the datatype i used for the productimg column is image.

row["prodcutimg"] = Fileuploadd1.FileName.ToString(); ----type of value has a mismatch with column type couldn't store <picture002,jpg> in productimg column. Expected type is Byte[]

解决方案

The error message is pretty explicit: it expects an array of bytes, and you are passing a string.
If you want to pass the file content, then you are doing the wrong thing anyway: that will only pass the name of the file, not the actual data the file contains.
Try:

byte[] filedata = Fileuploadd1.FileBytes;
row["prodcutimg"] = filedata;


这篇关于fileupload插入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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