CrystalReportViewer 9 "Use the ReportSource or DataBindings property to specify a report" - HELP!!!


A

Aaron Ackerman

Hi, My Name is Stumped.
I am developing .net project without using visual studio.net
environment.
I have created a report in Crystal reports 9.0.
I have written my code in vb.net to export and open the report. My
export is done perfectly where as my crystal report viewer part, gives
me the following error:

CrystalReportViewer - CrystalReportViewer1
Use the ReportSource or DataBindings property to specify a report
source.

The report runs fine on my development machine but when I push it to the
server....
I have put every single Crystal 9 .NET assembly in the bin directory.
besides it is not givin me an object error just saying my report source is
not set (which it is).
I even loaded the Crystal 9 IDE on the server to run the report there and to
see if any files I needed were missing, no help.

Can anyone please help me in this, I will be really helpful for me

Thanks in advance. Here is the Code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ShowReport("C:\Folder_Data\MyReport.rpt")
End Sub

Private Sub ShowReport(ByVal ReportName As String)
Try ' Set up structured error handling.
Dim crTableLogonInfo As New
CrystalDecisions.Shared.TableLogOnInfo
Dim crTableLogonInfos As New
CrystalDecisions.Shared.TableLogOnInfos
Dim crConnectionInfo As New
CrystalDecisions.Shared.ConnectionInfo
Dim myreportdocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocument


crConnectionInfo.ServerName = "MyServer"
crConnectionInfo.UserID = "sa"
crConnectionInfo.Password = ""
crConnectionInfo.DatabaseName = "MyDB"


' Create logon information for each table accessed
crTableLogonInfo.ConnectionInfo = crConnectionInfo
myreportdocument.Load(ReportName)

Dim crParameterFieldDefinitions As
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
Dim crParameterFieldDefinition As
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
Dim crParameterValues As CrystalDecisions.Shared.ParameterValues
Dim crParameterDiscreteValue As
CrystalDecisions.Shared.ParameterDiscreteValue

''Get the collection of parameters from the report
crParameterFieldDefinitions =
myreportdocument.DataDefinition.ParameterFields()
' 0-------First Parameter Value----(@ClientID)------------------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(0)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = 3 'Assign Parameter Here
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
' 1-------Second Parameter Value---(@BeginBillingDate)----------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(1)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "09/01/2003" 'Assign Parameter
Here
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
' 2-------Third Parameter
Value---(@EndBillingDate)----------------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(2)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "10/11/2003" 'Assign Parameter
Here
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
' 3-------Forth Parameter
Value---(@EmploymentConsultantSSN)----------------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(3)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "111223333" 'Assign Parameter
Here
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)



myreportdocument.Database.Tables.Item(0).ApplyLogOnInfo(crTableLogonInfo)

CrystalReportViewer1.DisplayToolbar = True
CrystalReportViewer1.ReportSource = myreportdocument

Catch ex As Exception ' Catch the error.
'Me.blnErrorLogged = ErrorLog(ex.ToString, ex.Source.ToString,
ex.TargetSite.Name.ToString, ex.Message.ToString) 'Log Error in DB

'Me.Close() 'Close Form
'Application.ExitThread() 'Exit App
Finally
' Beep after error processing.
End Try
End Sub
 
Ad

Advertisements

A

Aaron Ackerman

Thanks for all the help!!!

Aaron Ackerman said:
Hi, My Name is Stumped.
I am developing .net project without using visual studio.net
environment.
I have created a report in Crystal reports 9.0.
I have written my code in vb.net to export and open the report. My
export is done perfectly where as my crystal report viewer part, gives
me the following error:

CrystalReportViewer - CrystalReportViewer1
Use the ReportSource or DataBindings property to specify a report
source.

The report runs fine on my development machine but when I push it to the
server....
I have put every single Crystal 9 .NET assembly in the bin directory.
besides it is not givin me an object error just saying my report source is
not set (which it is).
I even loaded the Crystal 9 IDE on the server to run the report there and to
see if any files I needed were missing, no help.

Can anyone please help me in this, I will be really helpful for me

Thanks in advance. Here is the Code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ShowReport("C:\Folder_Data\MyReport.rpt")
End Sub

Private Sub ShowReport(ByVal ReportName As String)
Try ' Set up structured error handling.
Dim crTableLogonInfo As New
CrystalDecisions.Shared.TableLogOnInfo
Dim crTableLogonInfos As New
CrystalDecisions.Shared.TableLogOnInfos
Dim crConnectionInfo As New
CrystalDecisions.Shared.ConnectionInfo
Dim myreportdocument As New
CrystalDecisions.CrystalReports.Engine.ReportDocument


crConnectionInfo.ServerName = "MyServer"
crConnectionInfo.UserID = "sa"
crConnectionInfo.Password = ""
crConnectionInfo.DatabaseName = "MyDB"


' Create logon information for each table accessed
crTableLogonInfo.ConnectionInfo = crConnectionInfo
myreportdocument.Load(ReportName)

Dim crParameterFieldDefinitions As
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
Dim crParameterFieldDefinition As
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
Dim crParameterValues As CrystalDecisions.Shared.ParameterValues
Dim crParameterDiscreteValue As
CrystalDecisions.Shared.ParameterDiscreteValue

''Get the collection of parameters from the report
crParameterFieldDefinitions =
myreportdocument.DataDefinition.ParameterFields()
' 0-------First Parameter Value----(@ClientID)------------------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(0)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = 3 'Assign Parameter Here
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
' 1-------Second Parameter Value---(@BeginBillingDate)----------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(1)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "09/01/2003" 'Assign Parameter
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
' 2-------Third Parameter
Value---(@EndBillingDate)----------------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(2)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "10/11/2003" 'Assign Parameter
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
' 3-------Forth Parameter
Value---(@EmploymentConsultantSSN)----------------
crParameterFieldDefinition = crParameterFieldDefinitions.Item(3)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue = New
CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "111223333" 'Assign Parameter
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)



myreportdocument.Database.Tables.Item(0).ApplyLogOnInfo(crTableLogonInfo)

CrystalReportViewer1.DisplayToolbar = True
CrystalReportViewer1.ReportSource = myreportdocument

Catch ex As Exception ' Catch the error.
'Me.blnErrorLogged = ErrorLog(ex.ToString, ex.Source.ToString,
ex.TargetSite.Name.ToString, ex.Message.ToString) 'Log Error in DB

'Me.Close() 'Close Form
'Application.ExitThread() 'Exit App
Finally
' Beep after error processing.
End Try
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top