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

Discussion in 'ASP .Net Web Controls' started by Aaron Ackerman, Feb 13, 2004.

  1. 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
     
    Aaron Ackerman, Feb 13, 2004
    #1
    1. Advertising

  2. Thanks for all the help!!!

    "Aaron Ackerman" <> wrote in message
    news:...
    > 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
    >
    >
    >
     
    Aaron Ackerman, Feb 16, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Watkins

    CrystalReportViewer ReportSource problem

    Brian Watkins, Jul 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    2,578
    Brian Watkins
    Jul 10, 2003
  2. Shannon Cayze
    Replies:
    0
    Views:
    462
    Shannon Cayze
    Jul 22, 2003
  3. Christopher Campbell

    Horizontal position of the CrystalReportViewer Control

    Christopher Campbell, Aug 28, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,837
    Leon Jollans
    Aug 28, 2003
  4. Aaron Ackerman
    Replies:
    1
    Views:
    5,265
    Aaron Ackerman
    Feb 16, 2004
  5. Richard Thayne

    CrystalReportViewer Error HELP!

    Richard Thayne, Jan 6, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    656
    =?Utf-8?B?UGF1bA==?=
    Jan 6, 2006
Loading...

Share This Page