Visual Basic.NET - Cargar Datos Binarios en Reporte

 
Vista:
sin imagen de perfil

Cargar Datos Binarios en Reporte

Publicado por Jorge (2 intervenciones) el 12/06/2014 18:16:20
Hola, esta es mi primera consulta y agradeceré recibir la ayuda que necesito.

Mi Problema es que no puedo cargar una imagen guardada como datos binarios a mi Reporte.
Trabajo con Visual Basic 2005, SqlExpress2005 y Crystal reports 10.2. Tengo una tabla en mi BD donde guardo una imagen con el tipo de datos:Image. la consulta en sql para guardarla es asi:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Else
 
                Dim r As Integer = 0
                Dim FechaHoy As Date = Now
                Dim DM As String = "Inicio del Inventario"
                While r < DGP.Rows.Count - 1 ''Inserta los datos de un datagrid
                    If DGP.Rows(r).Cells(6).Value = Nothing Then
                        DGP.Rows(r).Cells(6).Value = "0"
                    End If
                    If DGP.Rows(r).Cells(7).Value = Nothing Then
                        DGP.Rows(r).Cells(7).Value = "0"
                    End If
                    Dim strBLOBFilePath As String = PB.ImageLocation.ToString
                    Dim fsBLOBFile As New FileStream(strBLOBFilePath, FileMode.Open, FileAccess.Read)
                    Dim bytBLOBData(fsBLOBFile.Length() - 1) As Byte
                    Dim cc As New SqlClient.SqlCommand("INSERT INTO Productos(CodigProdu,Nombr,Descr,UnidaMedic,CantiActua,PreciVenta1,PreciVenta2,PreciCompr,FechaVenci,Marca,UbicaAlmac,Obser,Estad,Image)values('" + DGP.Rows(r).Cells("CodigProdu").Value + "','" + DGP.Rows(r).Cells("Nombr").Value + "','" + DGP.Rows(r).Cells("Descr").Value + "','" + DGP.Rows(r).Cells("UnidaMedic").Value + "','" + DGP.Rows(r).Cells("CantiActua").Value + "','" + DGP.Rows(r).Cells("PreciVenta1").Value + "','" + DGP.Rows(r).Cells("PreciVenta2").Value + "','" + DGP.Rows(r).Cells("PreciCompr").Value + "','" + DGP.Rows(r).Cells("FechaVenci").Value + "','" + DGP.Rows(r).Cells("Marca").Value + "','" + DGP.Rows(r).Cells("UbicaAlmac").Value + "','" + DGP.Rows(r).Cells("Obser").Value + "','" + DGP.Rows(r).Cells(12).Value + "','" + fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length).ToString + "')", CBD)
                    fsBLOBFile.Close()
                    cc.ExecuteNonQuery()
                    cc = Nothing
 
                    r += 1
                End While
                DGP.Rows.Clear()
                MessageBox.Show("Datos ingresados correctamente")
            End If
            CBD.Close()
        End If

.............Cuando inserto una imagen y reviso la Tabla en el campo de la Imagen me muestra: <Datos Binarios>, que me imagino es mi imagen. Entonces lo que hago es Llamar a mi reporte y enviarle una consulta sql donde también está mis datos bianrios. Este es el Código:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Public Sub ImprimirPedido()
        CBD.Open()
        Dim da As New SqlDataAdapter("select * from Ventas,DetallesVenta,Productos where Ventas.CodigVenta='" + CBCodigVenta.Text + "' and DetallesVenta.CodigVenta=" + CBCodigVenta.Text + " and DetallesVenta.Produ=Productos.Produ", CBD)
        If da.SelectCommand.ExecuteNonQuery <> Nothing Then
            Dim dtdv As New DataTable
            Dim cont As Integer = 0
            da.Fill(dtdv)
            Dim RDP As New Pedidos
            Dim ds As New DataSet
            da.Fill(ds)
            ds = Nothing
            RDP.SetDataSource(dtdv)
            RDP.Refresh()
            FormPedidos.CRVP.ReportSource = RDP
            FormPedidos.CRVP.Refresh()
            FormPedidos.MdiParent = My.Forms.Principal
            FormPedidos.Show()
        Else
            MsgBox("No se puede imprimir, revise que el codigo de venta sea el correcto")
        End If
        da = Nothing
        CBD.Close()
    End Sub


......................... Tengo un dataSetTipado con todos los campos que deseo que esten en el reporte, incluido el campo de la imagen que establezco en el dataset como System.Byte. Luego Jalo estos datos en Mi Reporte.
Todos los campos aparecen exepto mi deseada imagen.

Adjunto las imagenes de mis datos
Por favor espero su ayuda, muchas Grcs.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Cargar Datos Binarios en Reporte

Publicado por oma (128 intervenciones) el 12/06/2014 19:06:13
envíame tu email para darte una solución al campo imagen y se vea reflejado en el reporte
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar