我认为你应该修改你的表结构,每个文件分多行进行保存。如,每行保存1M或者其他大小,分行update。

解决方案 »

  1.   

    谢谢。
        这似乎是个不错的主意。不过不知道有没有其他办法呢?其实在ADO.NET里通过DataReader是可以分批读取大容量数据的。所以我想知道有没有对应的写方法。
      

  2.   

    datareader是单向、只读的,如果写,可以用dataset的方法。
      

  3.   

    分块读:
    FileStream fs;
    fs=new FileStream("xxx.bmp",FileMode.Open,FileAccess.Read);

    BinaryReader br;
    br=new BinaryReader(fs);

    int bufferSize=100;
    byte[] input=new byte[bufferSize];input=br.ReadBytes(bufferSize);while(input.GetLength(0)==bufferSize)
    {
      //写数据
      ...  input=br.ReadBytes(bufferSize);
    }//写数据
    ...
      

  4.   

    用system.io的文件拷贝算了,难道你要传到服务器上几百兆的文件?
      

  5.   

    是呀,我要通过Web页面把几百兆的媒体文件存放到数据库中去。
      

  6.   

    看看这个:PRB: Cannot Upload Large Files When You Use the HtmlInputFile Server Control
    Q295626
    --------------------------------------------------------------------------------
    The information in this article applies to:Microsoft Visual Studio .NET (2002), Professional Edition 
    Microsoft ASP .NET (included with the .NET Framework)--------------------------------------------------------------------------------
    SYMPTOMS
    When you try to use the HtmlInputFile control to upload a large file, the file may not be uploaded. CAUSE
    This problem occurs because the default value for the maxRequestLength parameter in the <httpRuntime> section of the Machine.config file is 4096 (4 megabytes). As a result, files that are larger than this value are not uploaded by default. RESOLUTION
    To resolve this problem, use one of the following methods:In the Machine.config file, change the maxRequestLength attribute of the <httpRuntime> configuration section to a larger value. This change affects the whole computer.
    In the Web.config file, override the value of maxRequestLength for the application. For example, the following entry in Web.config allows files that are less than or equal to 8 megabytes (MB) to be uploaded:<httpRuntime maxRequestLength="8192" /> MORE INFORMATION
    This value is restricted to 4 MB by default to restrict possible Denial of Service attacks.The maximum possible size is 2 gigabytes (GB).