pb组件有一个blog数据类型, delphi里面不能访问,谁有方法???

解决方案 »

  1.   

    保存到数据库(拿Icon做例子,从我程序中截取的)
    procedure TDM.SetMsgIcon(const MsgType: string; Icon: TICON);
    begin
      if MsgType = '' then Exit;
      try
        try
          with ADOQMsgICON do
          begin
            Close;
            SQL.Text := 'Update MsgType Set Icon = :ICON Where InfoType = :InfoType';
            Parameters.ParamByName('ICON').Assign(ICON);
            Parameters.ParamByName('InfoType').Value := MsgType;
            ExecSQL;
          end;
        except
          raise;
        end;
      finally
        ADOQMsgICON.Close;
      end;
    end;从数据库取出
    function TDM.GetMsgIcon(const MsgType: string; ICON: TICON): Boolean;
    var
      ICONStream: TMemoryStream;
    begin
      Result := False;
      if MsgType = '' then Exit;
      ICONStream := TMemoryStream.Create;
      try
        try
          with ADOQMsgICON do
          begin
            Close;
            SQL.Text := 'Select ICON from MsgType Where InfoType = :InfoType';
            Parameters.ParamByName('InfoType').Value := MsgType;
            Open;
            if RecordCount = 0 then
            begin
              Result := False;
            end else
            begin
              TBlobField(FieldByName('Icon')).SaveToStream(ICONStream);
              ICONStream.Position := 0;
              if ICONStream.Size = 0 then
              begin
                Result := False;
              end else
              begin
                Icon.LoadFromStream(ICONStream);
                Result := True;
              end;
            end;
          end;
        except
          raise;
        end;
      finally
        ICONStream.Free;
        ADOQMsgICON.Close;
      end;
    end;