我想在一个表中插入图形,于是写了如下代码,可是插入的image数据中老是只有几个字符
//获得图象并把图象转换为byte[]
HttpPostedFile upPhoto = UpPhoto.PostedFile;
int upPhotoLength = upPhoto.ContentLength;
byte[] PhotoArray = new Byte[upPhotoLength]; Stream PhotoStream = upPhoto.InputStream;
PhotoStream.Read(PhotoArray, 0, upPhotoLength);
string sql = "update wgh_生产 set 图 ='"+PhotoArray+"' where 人员='"+this.Tbr.Text+"'";
Database.ExecuteSQL(sql);
Response.Write("图片上传成功");用事件跟踪了下,发现这个语句是这样的.
"update wgh_生产接稿 set 图 ='System.Byte[]' where 人员='22225555'"
我以上的语句错在哪里了呢,我调试时候photoarray是正常的,维数是几万多,可插入就成了这了呢?
求帮助,谢谢
//获得图象并把图象转换为byte[]
HttpPostedFile upPhoto = UpPhoto.PostedFile;
int upPhotoLength = upPhoto.ContentLength;
byte[] PhotoArray = new Byte[upPhotoLength]; Stream PhotoStream = upPhoto.InputStream;
PhotoStream.Read(PhotoArray, 0, upPhotoLength);
string sql = "update wgh_生产 set 图 ='"+PhotoArray+"' where 人员='"+this.Tbr.Text+"'";
Database.ExecuteSQL(sql);
Response.Write("图片上传成功");用事件跟踪了下,发现这个语句是这样的.
"update wgh_生产接稿 set 图 ='System.Byte[]' where 人员='22225555'"
我以上的语句错在哪里了呢,我调试时候photoarray是正常的,维数是几万多,可插入就成了这了呢?
求帮助,谢谢
byte[] bytes = System.Text.Encoding.Default.GetBytes(str);