We have to show different document by different application, So I think you must clear that which kind document you support at first, then show it by different application com.
如果是图片 How To Read and Write BLOB Data by Using ADO.NET with Visual C# .NET http://support.microsoft.com/default.aspx?scid=kb;EN-US;309158 但是不同的文件需要调用不同的查看器,所以很难统一, 不过使用浏览器控件能够查看一些常见的格式, 2005下已经有了托管的浏览器控件,建议使用。
How To Read and Write BLOB Data by Using ADO.NET with Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;309158
但是不同的文件需要调用不同的查看器,所以很难统一,
不过使用浏览器控件能够查看一些常见的格式,
2005下已经有了托管的浏览器控件,建议使用。
public static bool CreateFileFromByteAarray(byte[] stream, string fileName)
{
try
{
FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write);
fs.Write(stream, 0, stream.Length);
fs.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return false;
}
return true;
}public static byte[] FileToByteAarray(string fileName)
{
try
{
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
int FileSize = Convert.ToInt32(fs.Length);
byte[] stream = new byte[FileSize];
fs.Read(stream, 0, FileSize);
return stream;
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
return null;
}
}