Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
App. WinForms / WPF .NET
Lincare immagine crystalreport
martedì 20 dicembre 2005 - 13.42
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
angelweb
Profilo
| Newbie
11
messaggi | Data Invio:
mar 20 dic 2005 - 13:42
Ciao a tutti
Ho un grosso problema
Se associo ad un report di crystal report 9 un immagine scaricata su un campo image di sql server tutto funziona
se associo invece un immagine scaricata su un campo base64Binary di un dataset da me generarto questa non compare chi sa aiutarmi
ve ne sono estremamente grato.
trinity
Profilo
| Guru
3.465
messaggi | Data Invio:
mar 20 dic 2005 - 14:29
ho trovato sulla rete questo esempio di codice...spero che ti possa essere di aiuto.
Ciao
Code:
Private Sub btnLoadImage_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnLoadImage.Click
Dim ofdImage As New OpenFileDialog
If ofdImage.ShowDialog = DialogResult.OK Then
Try
'Create a new instance of the dataset
Dim dsImgRpt As New dsImageReport
'Create a new instance of the report
Dim m_imagereport As New rptImage
'Create a new row in the dataset
Dim dr As dsImageReport.ImageRow = _
dsImgRpt.Image.NewImageRow
'Set the various elements of the row
dr.Name = ofdImage.FileName
'fill this field with a byte array
dr.Photo = GetImageData(ofdImage.FileName)
'Add the new row to the dataset
dsImgRpt.Image.Rows.Add(dr)
'Use the dataset as datasource for the report
m_imagereport.SetDataSource(dsImgRpt)
'Show the report in the reportviewer
Me.crystalReportViewer1.ReportSource = m_imagereport
Catch ex As Exception
MessageBox.Show("Something went wrong: " & ex.Message)
End Try
End If
End Sub
Private Function GetImageData(ByVal fileName As String) As Byte()
'Method to load an image from disk and return it as a bytestream
Dim fs As System.IO.FileStream = _
New System.IO.FileStream(fileName, _
System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim br As System.IO.BinaryReader = New System.IO.BinaryReader(fs)
Return (br.ReadBytes(Convert.ToInt32(br.BaseStream.Length)))
End Function
Cirillo Fabio
www.wondernet.biz
fabio@wondernet.biz
angelweb
Profilo
| Newbie
11
messaggi | Data Invio:
mar 20 dic 2005 - 15:28
L'ho fatto anche io così il problema è che se linco il report ad un campo image di SQL server funziona tutto mentre se lo linco a un dataset con campo base64bynary l'immagine non si visualoizza.
Grazie
freeteo
Profilo
| Guru
6.542
messaggi | Data Invio:
mer 21 dic 2005 - 12:13
ciao,
1po di tempo fa ho scritto 1a tip a rigurado, e lo carico in in datatable in memoria:
http://www.dotnethell.it/tips/Crystal-Reports-BLOB.aspx
il source e' scaricabile infondo alla pag.
se fai come nell'esempio non funziona?
ciao
Matteo Raumer
.net addicted :-)
http://blogs.dotnethell.it/freeteo
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !