从sql数据库中将图⽚导出并重命名
郑凯资料while (dataReader1.Read())yaohao
{
//判断照⽚是否为空,不为空
if (dataReader1.GetValue(1) != DBNull.Value)
{
//数据库中获取到字节
fileData = (byte[])dataReader1.GetValue(1);
//照⽚路径
path = imageFolder + "\\" + sfzhm + "_" + xm + ".jpg";
MemoryStream ms = new MemoryStream(fileData);
古迹
Bitmap bmpt = new Bitmap(ms);
bmpt.Save(path);
if (bmpt != null)
{
//记得要释放,数据多的话
张含韵佟梦实恋情bmpt.Dispose();
}
}
else
{
//为空
path = imageFolder + "\\" + sfzhm + "_" + xm + ".jpg";
西游降魔篇演员
Bitmap bmpt = new Bitmap(100, 100);
bmpt.Save(path, ImageFormat.Jpeg);
if (bmpt != null)
{
bmpt.Dispose();男孩子取名字大全
}
}
}