下面的程序运行时出现invalid BLOB Length的提示错误,有哪位兄弟能帮我解决。
  if OpenPictureDialog1.Execute then
  begin
    Tbl_TENTERPRISEPIC.Edit;
    tblobfield(Tbl_TENTERPRISEPICF_PICTURE).LoadFromFile(OpenPictureDialog1.FileName);
    Tbl_TENTERPRISEPIC.Post;
  end;

解决方案 »

  1.   

    if OpenPictureDialog1.Execute then
      begin
        picstream:=TFileStream.Create(OpenPictureDialog1.filename,fmOpenRead);
        picstream.Position:=0;
        Tbl_TENTERPRISEPIC.Edit;
        tblobfield(Tbl_TENTERPRISEPICF_PICTURE).loadfromstream(picstream);
        Tbl_TENTERPRISEPIC.Post;
      end;
    这样的代码会报相同的错误。惨,不知如何解决。
      

  2.   

    下面是操作word的,和bmp图片是一致的,改改就行
    procedure TsampleForm.OpenDOCClick(Sender: TObject);
    var
      MemSize: Integer;
      Buffer: PChar;
      MyFile: TFileStream;
      Stream: TBlobStream;
    begin
      OpenDialog1.Filter:='WORD文档(*.DOC)|*.DOC'
    ;{从对话窗选择文件}
      if OpenDialog1.Execute then begin
        MyFile:=TFileStream.Create
    (OpenDialog1.FileName,fmOpenRead);
        with table1 do   {‘table1’为含BLOB字段的表名}
        begin
          Open;
          Edit;
          Stream := TBlobStream.Create(FieldByName('Doc')
     as TBlobField, bmWrite);
          {‘Doc’为BLOB字段名} 
          MemSize := MyFile.Size;
          Inc(MemSize); {Make room for the
     buffer's null terminator.}
          Buffer := AllocMem(MemSize);    
     {Allocate the memory.}
          try
            Stream.Seek(0, soFromBeginning);
     {Seek 0 bytes from the stream's end point}
            MyFile.Read(Buffer^,MemSize);
            Stream.Write(Buffer^,MemSize);
          finally
            MyFile.Free;
            Stream.Free;
          end;
               try
                 Post;
               except
                 on E: EDatabaseError do
               if HandelException(E)< >0 then exit
             else
             raise;
               end;
         end;
            Doc_ole.CreateObjectFromFile
    (OpenDialog1.FileName,False);
            Doc_ole.Run;{Doc_ole为ToleContainer构件名}
       end;
    end;
      

  3.   

    将bde 的Blobsize 增加大就好了,你的代码没有问题
      

  4.   

    我改了BLOB SIZE改成120000都不行。
      

  5.   

    知道问题的所在了,我用的是Sybase的桌面版,数据库只支持32K以内的图片。