Click here to Skip to main content
12,065,756 members (31,135 online)
Rate this:
 
Please Sign up or sign in to vote.
hi,

i need help on this

i'm trying to use a select query to assign records to both a main report and a subreport with two unlinked tables

this is my code

comm.Connection = conn
comm.CommandText = "Select * from ReceievedStock where month(DateReceived) = '" & dd1 & "' and Year(DateReceived) = '" & dd2 & "'"
da.SelectCommand = comm
 
da.Fill(das, "ReceievedStock")
'da.Dispose()

comm1.Connection = conn
comm1.CommandText = "Select * from IssuedStock where month(DateIssued) = '" & dd1 & "' and Year(DateIssued) = '" & dd2 & "'"
da.SelectCommand = comm1
 
da.Fill(das, "IssuedStock")

But when i display the report, the record comes in double(each set of record get duplicated)

Need help on this.. Thank you
Posted 15-Aug-12 23:45pm
v2
Comments
Adersh Ram 16-Aug-12 9:20am
   
Hi,
How did u set the report data source ?
kwamebounty 17-Aug-12 5:17am
   
I set the report datasource this way

rpt.SetDataSource(das)
CrystalReportViewer1.ReportSource = rpt

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Hi kwamebounty,

1. First u set the Main report and sub report link(right click the sub reoport and
select Sub Report link , link the master report id and sub report id)
2. Set the report data source
report.setdatasource(das.tables(0))
report.subreports(0).setdatasource(das.tables(1))

Let me know if it is not worked.

Thanks
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web03 | 2.8.160207.1 | Last Updated 18 Aug 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100