当前位置:Gxlcms > 数据库问题 > C# 把图片资源转成字节数组写入到数据库

C# 把图片资源转成字节数组写入到数据库

时间:2021-07-01 10:21:17 帮助过:11人阅读

fullpath = @"C:\Users\0380003020\Desktop\平面.png";//文件路径 System.IO.FileStream fs = new System.IO.FileStream(fullpath, System.IO.FileMode.Open); byte[] imagebytes = new byte[fs.Length]; System.IO.BinaryReader br = new System.IO.BinaryReader(fs); imagebytes = br.ReadBytes(Convert.ToInt32(fs.Length)); fs.Close(); CfgFileResource obj = new CfgFileResource(); obj.Rid = 0; obj.ResourceBody = imagebytes; obj.ResourceName = "3#3楼A区.png"; obj.ResourcePath = "Plan/Global/"; obj.UpdateTime = DateTime.Now; CfgFileResourceDao.Save(obj);

 

C# 把图片资源转成字节数组写入到数据库

标签:EDA   oba   image   字节   int   png   pre   ring   reader   

人气教程排行