-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: jeff
Message 1 in Discussion
Hi there,. i am creating a report using crystal reports 8.5 which is to be shown in a
browser. The SQL Query used to get the database fields contains a parameter '@PARAM'.
I add this parameter using asp.net code. But when i run it, it does not give me the
records. Please could anyone explain how to generate a report using a particular
parameter from asp.net. My SQL Query "select * from B where ID ='@PARAM'"
ASP.NET code ----------------
Dim pvCollection As New CrystalDecisions.Shared.ParameterValues()
Dim pdvCustomerName As New CrystalDecisions.Shared.ParameterDiscreteValue()
' Objects used to set the proper database connection information
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
' Create a report document instance to hold the report
Dim rptCustomersOrders As New ReportDocument()
Try
' Load the report
rptCustomersOrders.Load(Server.MapPath("NewReport.rpt"))
' Set the connection information for all the tables used in the report
' Leave UserID and Password blank for trusted connection
For Each tbCurrent In rptCustomersOrders.Database.Tables
tliCurrent = tbCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
.UserID = "sa"
.Password = "ta"
'.DatabaseName = "rnd"
.ServerName = "rxz"
End With
tbCurrent.ApplyLogOnInfo(tliCurrent)
Next tbCurrent
' Set the discreet value to the customers name.
pdvCustomerName.Value = "L/11/2003/68"
' Add it to the parameter collection.
pvCollection.Add(pdvCustomerName)
' Apply the current parameter values.
rptCustomersOrders.DataDefinition.ParameterFields("@PARAM").ApplyCurrentValues(pvCollection)
' Hide group tree for this report
crvParameter.DisplayGroupTree = False
' Set the report source for the crystal reports viewer to the
' report instance.
crvParameter.ReportSource = rptCustomersOrders
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]