Click here to Skip to main content
15,891,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

VB
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
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

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
 
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