本文介绍了请帮助-无法更新Mysql DB中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好朋友,以下帮助是为更新徽标图像而编写的代码,此代码未收到任何错误,但是当我查看数据库时,列值仅显示(排除)...(数据类型为longBlob)
请提示问题出在哪里.
Hi friends pls help below is code am writing for update a logo image this code is not getting any error but when i look in to database the column value is showing (Excluded) only...(datatype is longBlob)
pls suggest where is the problem.
protected void imgBtnSave_Click(object sender, ImageClickEventArgs e)
{
if (LogoUpload.PostedFile != null && !string.IsNullOrEmpty(LogoUpload.PostedFile.FileName))
{
byte[] imageSize = new byte[LogoUpload.PostedFile.ContentLength];
HttpPostedFile uploadedImage__1 = LogoUpload.PostedFile;
uploadedImage__1.InputStream.Read(imageSize, 0, Convert.ToInt32(LogoUpload.PostedFile.ContentLength));
cmd = new MySqlCommand ();
cmd.CommandText = "UPDATE schoolbook.t_school_master SET tsm_sch_logo=@Image where tsm_sch_code=''SCH00001''";
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
MySqlParameter UploadedImage__2 = new MySqlParameter("@Image", MySqlDbType.LongBlob);
UploadedImage__2.Value = imageSize;
UploadedImage__2.Size = imageSize.Length;
cmd.Parameters.Add(UploadedImage__2);
con.Open();
Int32 result=0;
result += cmd.ExecuteNonQuery();
con.Close();
}
else
{
Response.Write("<script>alert(''Browse Logo First'');</script>");
return;
//*****End if Picture Browse...
}
Response.Redirect("AboutSchoolEntry.aspx");
}
推荐答案
这篇关于请帮助-无法更新Mysql DB中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!