مشکل شما اینجا مطرح شده:
http://forums.asp.net/thread/1364045.aspx
راه حل:
I found the problem:
Using Crystal Reports for Visual Studio 2005, when you create a report it won't add a class which you could create a report instance with.
So you have to add:
Public Class myReport
Inherits ReportClass
Public Sub New()
MyBase.New()
End Sub
Public Overrides Property ResourceName() As [String]
Get
Return "myReport.rpt"
End Get
Set(ByVal value As [String])
'Do nothing
End Set
End Property
End
Class
In order to do:
Dim
myReportObject As New myReport
then you can do whatever you want with your instace, like setting parameters if you are using a stored procedure to populate your report
Dim
parm As New ParameterDiscreteValue()
Dim values As New ParameterValues()
parm.Value = strValue
values.Add(parm)
'This next line will set the value for your parameter avoiding the extremely anoying page that prompts for the parameters
myReportObject .DataDefinition.ParameterFields.Item(0).ApplyCurre ntValues(values)
'This lines will avoid the second most anoying page that prompts for user name and password if you are not using a trusted connection
myReportObject .SetDatabaseLogon(ConfigurationManager.AppSettings (
"user"), ConfigurationManager.AppSettings("Password"))
CrystlRprtVwr.ReportSource = myReportObject