我写了一个WINDOWS应用程序,
把word文档存储在数据库中的image栏里面。但是怎样才能在打开这个word文档,
我现在只能将这个文档的image栏读入一个DataSet中。但不懂得打开。

解决方案 »

  1.   

    FileStream fs;
    BinaryWriter bw;
    int buffersize=100;
    byte[] outbyte=new byte[buffersize]; 
    long reval;
    long startIndex;
    string filePath="";
    frame.bin.OracleProc OraProc=new frame.bin.OracleProc();
    string sql="select cfile,cname from  pro_v_indentcfile where id="+hidMsg.Value;
    OracleDataReader ord=OraProc.ExecuteReader(sql);
    if (ord.Read())
    {
    bin.Get_maxid  mid=new bin.Get_maxid();
    int fileid=0;
    fileid=mid.getfileid("fileno");
    filePath=Server.MapPath(".")+"\\"+"tempDoc"+"\\"+"file"+fileid.ToString()+".doc";
    fs=new FileStream(filePath,FileMode.OpenOrCreate,FileAccess.Write);
    bw=new BinaryWriter(fs);  
    startIndex=0;
    reval=ord.GetBytes(0,startIndex,outbyte,0,buffersize);
    while (reval==buffersize)
    {
    bw.Write(outbyte);
    bw.Flush();
    startIndex+=buffersize;
    reval=ord.GetBytes(0,startIndex,outbyte,0,buffersize);
    }
    if (reval > 0)
    bw.Write(outbyte,0,(int)reval-1);
    bw.Flush();
    bw.Close();
    fs.Close();
    }
    ord.Close();
    OraProc.ConnClose();
      

  2.   

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    using System.Configuration;
    using  System.IO; 
    using System.Threading;
    using Microsoft.Win32;
    using System.Net;别忘了using
      

  3.   

    十分感谢  laohuchiren(桌子凳子)
    我已经可以将数据写入文件了,但是我还想请问一点,怎样在界面一按读取按钮就能自动打开word文档?