从数据库中读取二进制写文件,有问题!
//写入到服务器端的文件名称
string FileName=null;
byte[] binaryData;
//服务器端的绝对路径
string FilePath=Request.MapPath(Request.Path);
FilePath=FilePath.Substring(0,FilePath.LastIndexOf(@"\")+1);
string Sql="select WDMC,WDLX,WDNR from 工作表 where WDBH='"+ID+"'";
DataSet ds=execute.dataSet(Sql);
FileName=ds.Tables[0].Rows[0][0].ToString().Trim()+".";
FileName+=ds.Tables[0].Rows[0][1].ToString().Trim();
binaryData=(byte[])ds.Tables[0].Rows[0][2];
MemoryStream myStream=new MemoryStream();
myStream.Write(binaryData,0,binaryData.GetUpperBound(0));
myStream.Flush();
MetaData.SaveStreamToFile(myStream,FilePath+FileName);
myStream.Close();
---------------------------------------------------------------------------
这样生成的文件是0字节的,怎么回事?