用内存流来操作....没有源码好象选择OLE类型的字段也可以....没试过

解决方案 »

  1.   

    这是我的代码的一部分(有修改),拿去参考吧procedure TwTybbBbgl.Dwj;
    var
      wjl:TFileStream;
      sjl:TStream;
      query:Tadoquery;
    begin
      sWj:=Trim(sWj);
      if sWj='' then exit;
      if Not FileExists(sWj) then
      begin
        wZkjck.Xxts('文件'+sWj+'不存在');
        exit;
      end;  try
        wjl:=TFileStream.Create(sWj,fmOpenRead);
      except
        wZkjck.Xxts('无法打开文件'+sWj);
        exit;
      end;  query:=tadoquery.create(nil);
      try
        query.connection:=adoconnection1;
        query.sql.add('select * from yourtable');
        query.Edit;
        sjl:=query.CreateBlobStream('column',bmWrite);
        sjl.CopyFrom(wjl,0);
        sjl.Free;
        wjl.Free;
        if query.Modified then query.Post;
      finally
        query.free;
      end;
    end;
      

  2.   

    sorry,上文引用了我的一些其他函数,看这个吧
    procedure TwTybbBbgl.Dwj(sWj:string);
    var
      wjl:TFileStream;
      sjl:TStream;
      query:Tadoquery;
    begin
      sWj:=Trim(sWj);
      if sWj='' then exit;
      if Not FileExists(sWj) then
      begin
        showmessage('文件'+sWj+'不存在');
        exit;
      end;  try
        wjl:=TFileStream.Create(sWj,fmOpenRead);
      except
        showmessage('无法打开文件'+sWj);
        exit;
      end;  query:=tadoquery.create(nil);
      try
        query.connection:=adoconnection1;
        query.sql.add('select * from yourtable');
        query.Edit;
        sjl:=query.CreateBlobStream('column',bmWrite);
        sjl.CopyFrom(wjl,0);
        sjl.Free;
        wjl.Free;
        if query.Modified then query.Post;
      finally
        query.free;
      end;
    end;