Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim obj As CRDataset = New CRDataset
  Dim obj1 As CRDataset = New CRDataset


VB
Dim balrow As DataRow = obj.Tables("DB_COM").NewRow()//obj for one group of value
                           balrow("fbankname") = gbankname
                           balrow("fbranchname") = gbranchname
                           balrow("fusername") = Guser
                           balrow("fworkstation") = worknode
                           balrow("fserverdt") = serverdt
                           Dim gpt As String = Format(fromdate.Value, "dd/MM/yyyy")
                           balrow("fdate") = gpt
                           balrow("fmainhead1") = fmainhead1
                           If OPENSTATE = "1" Or OPENSTATE1 = "1" Then
                               balrow("fcrtot") = CRBAL
                               balrow("fglhead") = fglhead
                               CRBAL = 0
                           End If
                           'If OPENSTATE1 = "2" And fglhead1 <> readglhead Or OPENSTATE = "2" And fglhead1 <> readglhead Then
                           '    balrow("fdrtot") = DRBAL
                           '    balrow("fglcode") = fglhead1
                           '    readglhead = fglhead1
                           'End If
                           obj.Tables("DB_COM").Rows.Add(balrow)
                           If OPENSTATE1 = "2" And fglhead1 <> readglhead Or OPENSTATE = "2" And fglhead1 <> readglhead Then
                               Dim alrow As DataRow = obj1.Tables("DB_COM").NewRow()//obj1 for another group of value
                               alrow("fmainhead2") = fmainhead2
                               alrow("fdrtot") = DRBAL
                               alrow("fglcode") = fglhead1
                               readglhead = fglhead1
                               obj1.Tables("DB_COM").Rows.Add(alrow)
                           End If

VB
Dim cr As New ReportDocument
       cr = New BALANCESHEET//crystall report

       cr.SetDataSource(obj.Tables("DB_COM"))//set datasource obj
 cr.SetDataSource(obj1.Tables("DB_COM"))//set datasource obj1
       repview.CrystalReportViewer1.ReportSource = cr
       repview.Show()

but its not showing two different value group together and display value in crytsall report...so how to merge two diffrent objects of dataset merge together..?
Posted
Updated 9-Aug-15 19:33pm
v2
Comments
Sinisa Hajnal 10-Aug-15 2:17am    
If their structure is the same (or at least similar), you could call obj.Merge with missingSchemaAction argument set to MissingSchemaAction.Add.

Or you could add the second DataTable into first dataset via obj.tables.Add or you could simply add that row into the existing table obj.Tables["DB_COM"].Rows.Add (alrow).

Choose one. I'd take the last one or better yet, return the data from the database in a single read if possible.
lakshjoshi 10-Aug-15 3:34am    
i used obj.merge(obj1) it combine data but after displaying in crystall report:--
item1...
item2..
item3...
item4.....
item5.....
item6..... like this its displaying
but my requirement is :
obj(value) obj1(value)
item1... item4...
item2.. item5...
item3... item6...
how to do this ..please help me if you can..thank you...
Maciej Los 10-Aug-15 3:26am    
Could you be so kind to provide more details...
lakshjoshi 10-Aug-15 3:34am    
i used obj.merge(obj1) it combine data but after displaying in crystall report:--
item1...
item2..
item3...
item4.....
item5.....
item6..... like this its displaying
but my requirement is :
obj(value) obj1(value)
item1... item4...
item2.. item5...
item3... item6...
how to do this ..please help me if you can..thak you...
Sinisa Hajnal 10-Aug-15 6:35am    
That is not a problem with the data. Google Crystal reports two-column detail layout.

If these are items bound together (i.e. item1 and item4 always need to be together, then you don't use merge, you create new column in the original table and write the data that needs to be together in the same row.

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