Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > SQL
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 27-02-2018
Avatar de mRoman
mRoman mRoman is offline
Miembro
 
Registrado: nov 2003
Posts: 646
Poder: 23
mRoman Va por buen camino
Otra forma

Hola buenas noches BlueSteel

Yo lo hago de esta forma (Lo q esta marcado con rojo, es lo q talvez necesites).

Código Delphi [-]
procedure TfrmProducto.btnGrabarClick(Sender: TObject);
var
   bmp:TBitmap; Stream:TStream;

begin
  inherited;
  try
        if chkBActivar.Checked then
            dsProducto.FieldByName('ACTIVAR_PRODUCTO').AsInteger:=1
        else
            dsProducto.FieldByName('ACTIVAR_PRODUCTO').AsInteger:=0;
        if chkKardex.Checked then
            dsProducto.FieldByName('CONTROL_KARDEX').AsString:='S'
        else
            dsProducto.FieldByName('CONTROL_KARDEX').AsString:='N';
        {Este clave servira para identificar si el producto es subsidiado o comercial,
        utilizando el numero 0 para los productos que son comerciales y el 1 para
        los productos subsidiados.}
        bmp:=TBitmap.Create;
        bmp.Assign(Image1.Picture.Graphic);
        dsProducto.FieldByName('TIPO_PRODUCTO').AsInteger:=cbxTipoProducto.ItemIndex;
        dsProducto.FieldByName('TIPO_LECHE').AsInteger:=cbxTipoLeche.ItemIndex;
        dsProducto.FieldByName('FOTO').Assign(bmp)  //Aqui le asigno la foto al campo de la tabla
        dsProducto.FieldByName('envase').AsString:=cbxEnvase.Text;
        dsProducto.FieldByName('embalaje').AsString:=cbxEmbalaje.Text;
        dsProducto.Post;
        dsProducto.ApplyUpdates;
        modDatos.trsFluida.Commit;
        btnGrabar.Enabled:=False;
        btnEliminar.Enabled:=False;
        btnCancelar.Enabled:=False;
        edClave.Text:='';
        edClave.SetFocus;
  except
        modDatos.trsFluida.Rollback;
        showmessage('Este registro no se puede Grabar');
  end;
end;

Y aqui...la leo de la tabla para q se muestre en un componente TImage
Código Delphi [-]
procedure TfrmProducto.pnlClavesExit(Sender: TObject);
var
i:integer;
begin
  inherited;
  dsProducto.Close;
  dsProducto.ParamByName('CVE_PROD').AsString:=edClave.Text;
  dsProducto.Open;
  if dsProducto.IsEmpty then
  begin
        btnGrabar.Enabled:=True;
        btnEliminar.Enabled:=False;
        btnCancelar.Enabled:=True;
        dsProducto.Append;
        dsProducto.FieldByName('CVE_PRODUCTO').AsString:=edClave.Text;
        GroupBox4.Enabled:=True;
  end Else Begin
        btnGrabar.Enabled:=True;
        btnEliminar.Enabled:=True;
        btnCancelar.Enabled:=True;
        dsProducto.Edit;
        if dsProducto.FieldByName('ACTIVAR_PRODUCTO').AsInteger=1 then
            chkBActivar.Checked:=True
        else
            chkBActivar.Checked:=False;
        if dsProducto.FieldByName('CONTROL_KARDEX').AsString='S' then
            chkKardex.Checked:=True
        else
            chkKardex.Checked:=False; 

        if dsProducto.FieldByName('tipo_producto').AsInteger=0 then
             Panel1.Visible:=True
        else
             Panel1.Visible:=False;

        for i:=0 to cbxEnvase.Items.Count -1 do
        begin
             if cbxEnvase.Items[i]=dsProducto.FieldByName('envase').AsString then
             begin
                  cbxEnvase.ItemIndex:=i;
             end;
        end;

        for i:=0 to cbxEmbalaje.Items.Count -1 do
        begin
             if cbxEmbalaje.Items[i]=dsProducto.FieldByName('embalaje').AsString then
             begin
                  cbxEmbalaje.ItemIndex:=i;
             end;
        end;
        if (dsProducto.FieldByName('stock_inicial').IsNull) or
           (dsProducto.FieldByName('stock_inicial').AsInteger=0) then
        begin
             GroupBox4.Enabled:=True;
        end;
        cbxTipoLeche.ItemIndex:=dsProducto.fieldByName('TIPO_LECHE').AsInteger;
        cbxTipoProducto.ItemIndex:=dsProducto.fieldByName('TIPO_PRODUCTO').AsInteger;
        Image1.Picture.Assign(dsProducto.fieldbyname('foto'));
  end;
end;

En la tabla declaras un campo tipo BLOB Binary....bueno eso en Firebird. Espero te sirva el ejemplo.

Saludos.
__________________
Miguel Román

Afectuoso saludo desde tierras mexicanas....un aguachile?, con unas "cetaseas" bien "muertas"?, VENTE PUES !!
Responder Con Cita
Respuesta


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Guardar Imagen de un TImage num11 Varios 3 19-03-2009 05:52:55
Guardar una Imagen a PDF atrus Gráficos 8 12-08-2008 10:36:03
Guardar imagen franfl Firebird e Interbase 1 29-02-2008 09:02:54
redimensionar y guardar una imagen gallipi Gráficos 1 24-05-2007 19:17:04
Guardar una imagen en un DB lore Conexión con bases de datos 5 20-03-2007 17:07:48


La franja horaria es GMT +2. Ahora son las 03:37:08.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi