Please help me.
This is the firsttime, Itried tocreate asubreportinCrystalReport at a Web Page Microsoft Visual Studio 2010.
I use tworeportfiles, consist of:
crInvoice.rpt and crIMEIMobilePhones.rpt
crInvoice.rpt is Main Report
crIMEIMobilePhones.rpt is afilewhichwillmakethe subreport at crInvoice.rpt
below, thecodeI use todisplayMainReportandsubreport. There might bea mistake. Pleasecorrected.
strSql = "select NoInvoice,IMEI, Namabarang,1 as Qty, hjual, diskon from tbtemp WHERE KdCabang='" & Server.HtmlEncode(Request.Cookies("KodeCabang").Value) & "'" myDataAdapter = New MySqlDataAdapter(strSql, myConnection) myDataAdapter.Fill(dsGrosir, "DTKwitansiGrosir") If dsGrosir.Tables("DTKwitansiGrosir").Rows.Count > 0 Then rpt = New crInvoice rpt.SetDataSource(dsGrosir) 'below, a query that I use to display Sub Report cmd.CommandText = "select Brand, IMEI from tbtemp" cmd.CommandType = CommandType.Text cmd.Connection = myConnection If cmd.Connection.State = ConnectionState.Closed Then cmd.Connection.Open() myDataAdapter.SelectCommand = cmd myDataAdapter.Fill(ds1, "DTIMEI") If ds1.Tables("DTIMEI").Rows.Count > 0 Then rptSub = New crIMEIMobilePhones rptSub.SetDataSource(ds1) End If CrystalReportViewer1.ReportSource = rpt CrystalReportViewer1.RefreshReport() End If
.
Thank you.