Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 13-12-2007
Avatar de thelibmx
thelibmx thelibmx is offline
Miembro
 
Registrado: mar 2007
Posts: 515
Poder: 18
thelibmx Va por buen camino
Cita:
Empezado por Caral Ver Mensaje
Hola
Yo de estas cosas no se, pero si el nombre blob es una variable de tipo tstream (blob:TStream; ), no se tendria que concatenar tambien?


Código Delphi [-]
Querygestion.SQL.add('insert into tabla_prueba(llave,nombre,archivoblob) values('+Edit1.Text+','''+tdEditAsunto.Text+''','+blob+')');


si pero marca error de tipo de datos
[Pascal Error] frmenu.pas(198): E2010 Incompatible types: 'string' and 'TStream'
alguna sugerencia?
__________________
En movimiento...
Responder Con Cita
  #2  
Antiguo 13-12-2007
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Poder: 25
Caral Va por buen camino
Hola
Pues parece que el campo blob es string, recuerda, no se de esto.
Tal vez asi:
Código Delphi [-]
Querygestion.SQL.add('insert into tabla_prueba(llave,nombre,archivoblob) values('+Edit1.Text+','''+tdEditAsunto.Text+''','+QuotedStr(blob)+')');
Saludos
Responder Con Cita
  #3  
Antiguo 13-12-2007
Avatar de thelibmx
thelibmx thelibmx is offline
Miembro
 
Registrado: mar 2007
Posts: 515
Poder: 18
thelibmx Va por buen camino
agradesco tu ayuda en verdad, yo estoy mas perdido, pero algo bueno siempre se aprende, se supone que blob esta declarado como Tstream, aun con el QuotedStr sigue marcando el mismo error, creo que hay algo que se esta pasando o tal ves es la manera incorrecta de hacerlo

Código Delphi [-]
procedure TFrmenuu.BitBtn1Click(Sender: TObject);
var
blob:TStream;
blobf:TBlobField;
fs:tstream;
begin
if OpenDialog.Execute then
begin
Olecontainer1.CreateObjectFromFile(PChar(OpenDialog.FileName),false);
vertbar.max:= Olecontainer1.Height;
horzbar.max:= Olecontainer1.Height;
Panelcontenedor.Visible:=true;
Querygestion.Close;
Querygestion.SQL.Clear;
Querygestion.SQL.add('insert into tabla_prueba(llave,nombre,archivoblob) values('+Edit1.Text+','''+tdEditAsunto.Text+''','+QuotedStr(blob)+')');
Querygestion.ExecSQL;
//Querygestion.Open;
showmessage('agregado');

blob:=querygestion.CreateBlobStream(querygestion.DataSource.DataSet.FieldByName('archivoblob'), bmwrite);
  //
  try
    blob.Seek(0, soFromBeginning);
    with TFileStream.Create(OpenDialog.FileName, fmCreate) do
      try
        CopyFrom(blob, blob.Size)
      finally
        Free
      end;
  finally
    blob.Free
  end;
end;
end;

no pense que fuera tan complicado subir un archivo a una base de datos
__________________
En movimiento...
Responder Con Cita
  #4  
Antiguo 13-12-2007
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Poder: 25
Caral Va por buen camino
lo he tratado de arreglar pero no se ve bien
Si algun moderador lo arregla, por favor
Esta en el siguiente post.
Gracias

Última edición por Caral fecha: 13-12-2007 a las 22:11:30.
Responder Con Cita
  #5  
Antiguo 13-12-2007
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Poder: 25
Caral Va por buen camino
Hola
Y asi:

Código Delphi [-]var blob:TBlobStream;
blobf:TBlobField;
fs:tstream;
begin

Este es el ejemplo completo

Código Delphi [-]procedure TForm1.Button1Click(Sender: TObject);
var
Stream1: TBlobStream;
Stream2: TStream;
begin
Stream1 := TBlobStream.Create(Table1Notes, bmRead);
try ClientDataSet1.Edit; { here’s a different way to create a blob stream }
Stream2 := ClientDataSet1.CreateBlobStream(ClientDataSet1.FieldByName('Remarks'), bmReadWrite);
try
Stream2.CopyFrom(Stream1, Stream1.Size); ClientDataSet1.Post;
finally
Stream2.Free;
end;

finally Stream1.Free;
end;
end;



Insisto, no se, pero esta en el help
Saludos
Responder Con Cita
  #6  
Antiguo 13-12-2007
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Poder: 25
Caral Va por buen camino
Hola
Ya consulte a mi Maestro Egostar y en el help sale esto:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);

var
  Stream1, Stream2 : TIBBlobStream;
begin
  Stream1 := TIBBlobStream.Create(IBTable1Notes);
  try
    Stream1.Mode = bmRead;
    IBTable2.Edit;
    { here’s a different way to create a blob stream } 
    { note that with this one, we don’t need a try.. finally clause }
    { because we are not responsible for freeing the stream }
    Stream2 := IBTable2.CreateBlobStream(IBTable2.FieldByName('Remarks'), bmReadWrite);
    Stream2.CopyFrom(Stream1, Stream1.Size);

    IBTable2.Post;
  finally
    Stream1.Free;
  end;
end;
Ahi lo dice todo.
Saludos
Responder Con Cita
  #7  
Antiguo 13-12-2007
Avatar de thelibmx
thelibmx thelibmx is offline
Miembro
 
Registrado: mar 2007
Posts: 515
Poder: 18
thelibmx Va por buen camino
no se si sea mucho abusar pero podrias explicar un poco el codigo ?
__________________
En movimiento...
Responder Con Cita
Respuesta



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
Insertar y recuperar una imagen en un campo blob bluegene Lazarus, FreePascal, Kylix, etc. 1 30-03-2007 20:07:21
Insertar y recuperar una imagen en un campo blob bluegene MySQL 0 30-03-2007 20:01:43
Insertar datos en archivo word desde aplicacion Delphi JulioGO Servers 1 24-02-2007 22:43:16
insertar registro en campo blob con asp oarias Firebird e Interbase 0 09-02-2007 18:42:50
¿Como Guardar un Bmp/Jpg en un campo BLOB desde Delphi? LuCkY_007 MySQL 4 18-01-2007 12:05:26


La franja horaria es GMT +2. Ahora son las 16:50:32.


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