| jscubillos5 |
07-03-2014 13:34:38 |
Hola comunidad
Gracias por su ayuda, finalmente lo único que tuve que haces fue lo siguiente, crear un procedimiento almacenado, el cual recibe todos los datos, de una única tabla llamada IMAGEN, y por su puesto recibe la imagen que quería guardar en la base, luego en el código PASCAL solo tuve que colocar 2 objetos sobre un formulario, un TIMAGE, y un TBUTTON, en el evento ONCLIK del BUTTON, coloque los siguiente:
Código Delphi [-]procedure TFormPrincipal.ButtonGuardarClick(Sender: TObject);
begin
if OpenDialogFormPrincipal.Execute then
begin
ImageFormPrincipal.Bitmap.LoadFromFile(OpenDialogFormPrincipal.FileName);
try
try
IBStoredProcInsertarImagen.Prepare;
IBStoredProcInsertarImagen.ParamByName('FORMATOIMAGEN').Value:= AnsiUpperCase(ExtractFileExt(OpenDialogFormPrincipal.FileName));
IBStoredProcInsertarImagen.ParamByName('NOMBRE').Value:= ExtractFileName(OpenDialogFormPrincipal.FileName);
IBStoredProcInsertarImagen.ParamByName('UBICACION').Value:= ExtractFilePath(OpenDialogFormPrincipal.FileName);
IBStoredProcInsertarImagen.ParamByName('IMAGEN').LoadFromFile(OpenDialogFormPrincipal.FileName, ftBlob);
IBStoredProcInsertarImagen.ExecProc;
ShowMessage('La imagen fue exitosamente cargada.');
if not IBTransactionPruebas.InTransaction then
begin
IBTransactionPruebas.StartTransaction;
end;
IBTransactionPruebas.Commit;
finally
IBStoredProcInsertarImagen.Close;
end;
except
on Error: Exception do
begin
ShowMessage('Atención ha ocurrido un error: ' + Error.Message);
end;
end;
end
else
begin
end;
end;
|