如何image字段内容转换出string
sql库里目前存放各种文档,比如pdf,word,txt等 以二进制方式存放在image字段里
使用的方式
int filelength= File1.PostedFile.ContentLength;
byte[] FileByteArray = new byte[filelength];
Stream StreamObject = File1.PostedFile.InputStream;
StreamObject.Read(FileByteArray,0,filelength);
.......
现在是要把这些东西从库里读出来要读到string里
(不要使用把文件写到磁盘上,然后再转换到txt的方法)
string sqlstr="select * from wzfj where wzfjid=120" ;
SqlDataReader sdr=ExecuteReader(sqlstr);
if (sdr.Read())
{
Byte[] FileByteArray = new Byte[200000]; //文件临时储存Byte数组
FileByteArray=(byte[])(sdr["nr"]);
string getstring = getFnS( FileByteArray)
}
问
getFnS怎么写?