在oracle数据库db1上表t1有2个字段a1 number(10),tp1 blob,在oracle数据库db2上表t2有2个字段a2 number(10),tp2 blob,t1有多条记录,a1分别为1,2,3,4,5... 请问如何用数据流的形式用adoquery读t1的某一条记录的图像数据,用adoquery插入到db2的t2?

解决方案 »

  1.   

    //用流存取图片
    var
      M:TMemoryStream;  if Image1.Picture.Bitmap.Empty then  exit;
      M := TMemoryStream.Create;
      try
        Image1.Picture.Graphic.SaveToStream(M);
        ..
        q1.parameters[2].LoadFromStream(M,ftBlob);//照片
        execsql;
      finally
        M.Free; 
      end;//取:   
        mStream:=TMemoryStream.Create;
        try
          TBlobField(FieldByName('hy_zp')).SaveToStream(mStream);
          mStream.Position :=0;
          image1.Picture.Bitmap.LoadFromStream(MStream);        
        finally
          mStream.Free;
        end;