Ver Mensaje Individual
  #4 (permalink)  
Antiguo 11/11/2008, 09:56
sanv
 
Fecha de Ingreso: agosto-2008
Mensajes: 7
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Recuperar campo Blob

Cita:
Iniciado por memox32 Ver Mensaje
trabajo con APEX, Y NECESITO MOSTRAR ESE CAMPO BLOB EN UN PDF
Hola espero que te ayude :
/***************Insertar*********************/

protected void btnSave_Click(object sender, EventArgs e)
{
try
{
string num_maximo = Maximo_Anexo();
string strnom_documento = (string)Session["fileName"];
string num_transaccion = (string)Session["transaccion_id"];


DMQ.CATASTRO.GLOBAL.xGlobal xGlobal = new DMQ.CATASTRO.GLOBAL.xGlobal();

OracleConnection Conn = xGlobal.GetConnection();
OracleCommand Cmd = new OracleCommand("INSERT INTO CON_ANEXO (ANEXO_ID,TRANSACCION_ID,TANEXO_ID,DESCRIPCION,NOM _DOCUMENTO,DOCUMENTO) VALUES (CON_ANEXO_SEQ.NEXTVAL," + num_transaccion + "," + this.ddlANEXO_ID.SelectedValue + ",'" + this.txt_descripcion.Text + "','"+strnom_documento+"',:FOT_IMAGEN)", Conn);

//eliminar_cache();

String fileName = (String)Session["fileName"];
String strBLOBFilePath = Server.MapPath(@"~/Images/Anexos/" + fileName);
//String strBLOBFilePath = Server.MapPath(@"~/Images/Anexos/" + txt_descripcion.Text);
// System.IO.File.Create(strBLOBFilePath);


//FileStream fsBLOBFile = new FileStream(strBLOBFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);


FileStream fsBLOBFile = new FileStream(strBLOBFilePath, FileMode.Open, FileAccess.Read);



long lenght = Convert.ToInt64(Session["length"]);
Byte[] bytBLOBData = new Byte[lenght];
//System.IO.File.Create(strBLOBFilePath, bytBLOBData.Length);

// FileStream fsBLOBFile = new FileStream(strBLOBFilePath, FileMode.Open, FileAccess.Read);

fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length);
fsBLOBFile.Close();
OracleParameter prm = new OracleParameter("FOT_IMAGEN", OracleType.Blob, bytBLOBData.Length, ParameterDirection.Input, false, 0, 0, null, DataRowVersion.Current, bytBLOBData);

Cmd.Parameters.Add(prm);
Cmd.ExecuteNonQuery();
Conn.Dispose();
Limpiar_Foto();
lblErrorMessage.Visible = true;
lblErrorMessage.Text = "Tu archivo ha sido grabado exitosamente.";
eliminar_cache();


}
catch (Exception ex)
{
enterroringreso.Codigo = veriingreso.Verifica_Mensaje(ex.Message.Trim().ToS tring());
comparaxmlingreso.CompararXML(enterroringreso);
this.lblErrorMessage.Visible = true;
if (enterroringreso.Codigo_Error == null)
this.lblErrorMessage.Text = enterroringreso.Codigo;
else
this.lblErrorMessage.Text = enterroringreso.Descripcion;

}
}
/************************************************** *****/
soy malo explicando pero en este boton grabo imagenes en oracle en C#