AdoUpdateContent里的SQL语句是(select content from oasmalldoc)
   Word_FileStream := TFileStream.Create(Opendialog1.FileName, fmOpenRead);
    try
      Word_FileStream.Position := 0;
      AdoUpdateContent.edit;
      TBlobField(AdoUpdateContent.FieldByName('Content')).LoadFromStream  (Word_FileStream);
      AdoUpdateContent.Post;
    finally
      Word_FileStream.free;
    end;
  end;
上面代码执行后,所要打开的文档并没有以流的方式保存进CONTENT字段中,该字段内容仍然为NULL值,请教是何原因,谢谢!!!

解决方案 »

  1.   

    大概有点印象,select content from oasmalldoc,此时SQL中只有content字段是不行的,把ID之类的主键加入SQL就可以了。
      

  2.   

    var
      MemoStream : TStream;
    begin
    Word_FileStream := TFileStream.Create(Opendialog1.FileName, fmOpenRead);
        try
          Word_FileStream.Position := 0;
          AdoUpdateContent.edit;
          MemoStream:=AdoUpdateContent.CreateBlobStream(
                        AdoUpdateContent.FieldByName('Content'),bmWrite);
           MemoStream.CopyFrom(Word_FileStream,Word_FileStream.Size);
        finally
          Word_FileStream.free;
          MemoStream.free;
        end;
         AdoUpdateContent.Post;
    end;
      

  3.   


    把try拿掉应有提示的,looklook。
    另外同意楼上的。
      

  4.   

    按: zhaohui_1981(晨光)的代码,依然保存为NULL值,不知道到底哪儿出问题了?