Click here to Skip to main content
15,907,913 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I have a dataset with 2 datatables "Load_image", "Load_Word". I am trying to set them up as data source to crystal reports and data is not passing to respective fields.

When I am passing only one dataTable, Data Populates on Crystal Report. I am including the code also.

VB
Public Sub Preview_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cryRpt As New PreviewReport
        Dim sample As New DataSet
        Dim FS As FileStream
        Dim DTImage As New DataTable("Load_Image")
        Dim DTText As New DataTable("Load_Word")
        Dim IRow As DataRow
        DTImage.Columns.Add("HeaderImage", System.Type.GetType("System.Byte[]"))
        IRow = DTImage.NewRow
        Dim IR As BinaryReader
        cryRpt.Load("F:\Projects\2008 Projects\VB.NET\Print from wordpad\Print from wordpad\PreviewReport2.rpt")
        FS = New FileStream(Load_MS_Word.getfilepath, FileMode.Open)
        IR = New BinaryReader(FS)
        Dim imgbyte(FS.Length) As Byte
        imgbyte = IR.ReadBytes(Convert.ToInt32((FS.Length)))
        IRow(0) = imgbyte
        DTImage.Rows.Add(IRow)
        sample.Clear()
        sample.Tables.Add(DTImage)
        sample.Tables.Add(DTText)
        IR.Close()
        FS.Close()
        DTText.Columns.Add("RTFText", GetType(String))
        DTText.Rows.Add(Picture)
        cryRpt.SetDataSource(sample)
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
    End Sub


The Columns from Tables "Load_image" and "Load_word" are already on the crystal report.

Please help me in this.
Posted
Comments
Vamshi Krishna Naidu 19-Dec-11 17:49pm    
No one has any answer for this or is it not possible?

hi,

ya, for this u have 2 options

1. try to make two tables as single

2. put one dataset/datatable, define the columns manually then assign the values then assign it to crystal report.

if u hav any doubts reply me...
 
Share this answer
 
Comments
Vamshi Krishna Naidu 22-Dec-11 16:48pm    
That is what i did. I created two datatables in a data set. Manually added columns into two different datatables. Under crystal reports updated the details under datasourde. Added two columns into the reports. Still no luck.

Also if i use single data table and drag the column into report, Then it will show the data, Multiple tables are not working. Do i have to do a subreport and then suppress both on one?

Please help me.
I figured out that the second table that I am passing on from second function is overlapping the first one. So I created 2 new tables in code and then tried and it worked.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900