|
-
Nov 22nd, 2006, 12:51 PM
#1
Thread Starter
Lively Member
[RESOLVED] Crystal reports - Pass parameters and change connection string
Hello guys,
I have a report which datasource is a stored procedure in a SQL2005 database. I designed the report with a parameter value as an example to view results. Now I need to send the parameter programmatically and also I need to change the connection string for the report to connect with the database.
Thanks!!
Last edited by Shardox; Nov 23rd, 2006 at 05:56 AM.
Reason: [RESOLVED]
-
Nov 22nd, 2006, 07:17 PM
#2
Lively Member
Re: [2005] Crystal reports - Pass parameters and change connection string
Hope this help:
http://www.codeproject.com/useritems..._Connectio.asp
VB Code:
Dim rpt As New crpYourReport
rpt.PrintOptions.PaperOrientation = PaperOrientation.Landscape
Try
Dim rptViewer As New frmReport
rpt.SetDataSource(mydataset.Tables(TBL_NAME))
rptViewer.crpViewer.ReportSource = rpt
Dim paramFields As New ParameterFields
Dim paramField As New ParameterField
Dim discreteVal As New ParameterDiscreteValue
paramField.ParameterFieldName = "paramname"
discreteVal.Value = modGeneral.strCompanyName
paramField.CurrentValues.Add(discreteVal)
paramFields.Add(paramField)
rptViewer.crpViewer.ParameterFieldInfo = paramFields
rptViewer.crpViewer.Zoom(7)
rptViewer.Show()
Catch Excep As Exception
End Try
-
Nov 23rd, 2006, 05:55 AM
#3
Thread Starter
Lively Member
Re: [2005] Crystal reports - Pass parameters and change connection string
Thanks lingsn, your code worked!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|