Question : Visual Studio 2005, Crystal Report Viewer 10, displaying dynamic image

I already posted that question and was able to have the image display using Crystal Report X1 but my problem is that this was from working at home with "non legit version" of CR.

The second option was to create a dataset which would hold the image data
see.

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_24905564.html

The problem is that the example from that question were using image that were stored on pictureboxes with his not my case, i need to load them from  a filepath.

With this help of this website
http://inspirone.blogspot.com/2007/01/loading-images-dynamically-in-crystal.html
I manage to the the image store in the dataset  "to test im just using a path in text format rather than from the database.

Everything seems to be working fine, i do not have any error message, the report shows but the blob field created by my dataset is empty instead of having the image.

The dataset is name ImageDataset
The Table is called objDataTable
 the only column in the table is called EspaceClos_FilePath and its DataType is "System.Byte()" i had to include the brackets at the end of the DataType

 else i would get the  error message
Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'.Couldn't store in EspaceClos_FilePath Column.  Expected type is Byte.

 at the line: ds.Tables(0).Rows(0)("EspaceClos_FilePath") = Image

I have attached the code used to store the image in the dataset and the one cally the report .
The part calling the report "after the end try" is working fine for my other reports that i print using that same application.

Does anyone know Why i wouldn't be able to show the image even using the dataset?

Im using
Visual Studio 2005 Team Edition Version 8.0.500727.42 (TRM.060727-4200)
.NET Framework version 2.0.60727 SP2
and
Crystal Report Reference version is 10.2.3600.0

Thanks for your help in advance.
Code Snippet:
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:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
If gsPrtReptCallReport = "rptFicheCaracterisation" Then
            Try
                Dim ds As New ImageDataSet
                Dim fs As System.IO.FileStream = New System.IO.FileStream("C:\Documents and Settings\jobink\Desktop\To Finish\PROJET_NET\Img\EC 3 - TNB-SSE-Logo.JPG", System.IO.FileMode.Open, System.IO.FileAccess.Read)
                Dim Image() As Byte = New Byte(fs.Length - 1) {}

                myReport = New rptFicheCaracterisation

                Using da As New DataTable("objDataTable")

                    da.Columns.Add("EspaceClos_FilePath", GetType(Byte()))

                    ds.Tables(0).Rows.Add()

                    fs.Read(Image, 0, CType(fs.Length, Integer))
                    fs.Close()
                    ds.Tables(0).Rows(0)("EspaceClos_FilePath") = Image

                    myReport.SetDataSource(ds.Tables(0))

                    myReport = New rptFicheCaracterisation
                    crParameterDiscreteValue.Value = giPrtReptEspaceClos
                    crParameterFieldDefinitions = myReport.DataDefinition.ParameterFields()
                    crParameterFieldDefinition = crParameterFieldDefinitions.Item("ParamEspaceClosID")
                    crParameterValues = crParameterFieldDefinition.CurrentValues

                    crParameterValues.Clear()
                    crParameterValues.Add(crParameterDiscreteValue)
                    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
                End Using
            Catch ex As Exception
                Throw New Exception(ex.Message)
            End Try
        End If

        With myConnectionInfo
            .UserID = "admin"
            .Password = "candev"
        End With

        CrReportViewer.DisplayGroupTree = False
        CrReportViewer.ShowExportButton = False
        CrReportViewer.ShowRefreshButton = False

        myTableLogonInfo.connectioninfo = myConnectionInfo
        myTableLogonInfos.Add(myTableLogonInfo)
        CrReportViewer.LogOnInfo = myTableLogonInfos
        CrReportViewer.ReportSource = myReport
        CrReportViewer.Refresh()

Answer : Visual Studio 2005, Crystal Report Viewer 10, displaying dynamic image

try opening jus the vbproj file... not the solution....
Random Solutions  
 
programming4us programming4us