Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2007, 05:19 AM
Registered User
 
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to Pass Parameter to Sub Report in asp.net 2.0

Hi all,

I have a Main Report in which i have more than 4 subreports,
I m getting an error "Missing Parameter"
i m setting main report parameter through this code
myReportDocument.SetParameterValue("param1",obj1)
I dont know how to pass parameter for sub report.
can any one help i will be greatfull for him.


 
Old November 5th, 2007, 12:20 AM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default

There is one more argurment you can pass
myReportDocument.SetParameterValue("param1",obj1,s ubreportname)

Another method is you can right click on subreport object on main report you will find option "link",
then you have to map parameter passed to mainreport to subreport parameter.



urt
 
Old March 1st, 2008, 02:17 AM
Registered User
 
Join Date: Mar 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Dim myCon As New SqlClient.SqlConnection()
myCon.ConnectionString = ConfigurationManager.ConnectionStrings("MyCon").Co nnectionString
Dim mycmd As New SqlClient.SqlCommand()
Dim mycmd1 As New SqlClient.SqlCommand
mycmd.Connection = myCon
mycmd1.Connection = myCon
' For Stored Procedure
mycmd.CommandType = CommandType.StoredProcedure
mycmd.CommandText = "Depo_InvoicePrint"
mycmd.Parameters.Add("@InvNo", SqlDbType.VarChar)
mycmd.Parameters("@InvNo").Value = Session("InvoiceNo")

mycmd1.CommandType = CommandType.StoredProcedure
mycmd1.CommandText = "Depo_InvoicePrintSubreport"
mycmd1.Parameters.Add("@InvNo", SqlDbType.VarChar)
mycmd1.Parameters("@InvNo").Value = Session("InvNo")

Dim myda As New SqlClient.SqlDataAdapter()
myda.SelectCommand = mycmd
Dim myDs As New DataSet()
myda.Fill(myDs, "InvoicePrint") ' name of the Stored Proc for main report

Dim myda1 As New SqlClient.SqlDataAdapter()
myda1.SelectCommand = mycmd1
Dim myDs1 As New DataSet()
myda1.Fill(myDs1, "InvoicePrintSubreport") ' name of the Stored Proc for subreport

mycmd.Dispose()
mycmd1.Dispose()
myCon.Close()

oRpt.Load(Server.MapPath(c:/rptInvoicePrint.rpt"))
oRpt.FileName = Server.MapPath(c:/rptInvoicePrint.rpt")
oRpt.SetDataSource(myDs)
oRpt.OpenSubreport("rptInvoicePrintSub").SetDataSo urce(myDs1)

oRpt.SetParameterValue("@InvNo", Session("InvoiceNo")) 'parameter for main report
oRpt.SetDatabaseLogon(Session("dbuser"), Session("dbpass"))

oRpt.SetParameterValue("@InvNo", Session("InvoiceNo"), "rptInvoicePrintSub") ' parameter for subreport

myCon.Close()


[/quote]






Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal Report Parameter pass from c# shriji.1111 Crystal Reports 4 June 14th, 2011 11:38 AM
How to pass parameter to a crystal report using c# preetakrish BOOK: Professional Crystal Reports for VS.NET 16 November 19th, 2009 05:26 AM
pass parameter in crystal report srivigdev C# 3 April 14th, 2008 12:11 PM
Pass parameter from XSLT to ASP.NET kwilliams XSLT 3 August 17th, 2005 11:56 AM
How to pass parameter to sub-report . azeerum Access 1 January 3rd, 2005 04:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.