Results 1 to 5 of 5

Thread: Crystal Reports displaying wrong data

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2009
    Posts
    105

    Crystal Reports displaying wrong data

    I followed the tutorial and it seemed very easy but when I ran the report I am not getting the data out of my database I'm getting off the wall stuff like colors and such? Any ideas? I have no coding because the tutorial had me go thru a wizard and when he ran his report it looked fine but when I did it (I followed each step exactly) it was wrong.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Crystal Reports displaying wrong data

    What tutorial did you follow?

  3. #3
    New Member
    Join Date
    Feb 2010
    Posts
    2

    Re: Crystal Reports displaying wrong data

    Quote Originally Posted by Hack View Post
    What tutorial did you follow?
    I am encountering the same problem as the post above.

    I followed a Visual Studio for dummies tutorial. I can describe it below

    I have a database that stores testing results that are entered by the user.

    I created a dataset named results. That I used the data designer (drag and drop) to create. I did not modify what the wizard created, merely made sure that the data showed up by "previewing data" through the menu.

    I created a Crystal Report by using the creation wizard and at this point I'm merely looking to make sure I can create the report correctly, I'm not modifying anything at this point. I selected my dataset as the source of my report.

    I have a web form that I used the wizard/tool box to drag and drop a crystal report source and crystal report viewer onto. I point each tool the the appropriate source (IE viewer looks for report). When I use the report viewer (button at the bottom of the screen) I see a report that is merely colors, dates, and heading names. No real data.

    When I debug the webform the report date (and manually added text) is the only thing that shows up.

    I'm working in Visual Studio 2008 and after frustration I attempted to bypass the toolbox and create, link and update the report using VB code and I get the same results.

    I'm currently at work so I can't supply the code or specific VB/Crystal Reports version. I will do that tonight, but if its something simple I'm doing wrong any help would be appreciated.

    Edit -

    Here is the code snippet that I'm using.

    VB CODE
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim report As New ReportDocument()
    Dim MyConnection As New System.Data.SqlClient.SqlConnection
    Dim MySqlCommand As New Data.SqlClient.SqlCommand
    Dim adpt As New System.Data.SqlClient.SqlDataAdapter()
    Dim viewer As New CrystalDecisions.Web.CrystalReportViewer
    report.Load(Server.MapPath("CrystalReport.rpt"))
    MyConnection.ConnectionString = ("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
    MySqlCommand.Connection = MyConnection
    MySqlCommand.CommandText = "SELECT * FROM [Results]"
    adpt.SelectCommand = MySqlCommand
    MyConnection.Open()
    Dim Results As New DataTable()
    adpt.Fill(Results)
    'report.SetDataSource(Results.Tables(0))
    report.Database.Tables(0).SetDataSource(Results)
    viewer.ReportSource = report
    viewer.Visible = True
    MyConnection.Close()
    End Sub

    /VBCODE

    I'm a VB newbie, so I tried to see what version of VB I was using and the only information I could come up with is that Visual Studio uses Visual Basic 2008. I assume that is a VB version but if its not I might need help finding the version, if needed. Thanks for your help.
    Last edited by MichiganBorn; Feb 28th, 2010 at 01:12 PM. Reason: Updating the information - including my code snippet for better analysis

  4. #4
    New Member
    Join Date
    Feb 2010
    Posts
    2

    Re: Crystal Reports displaying wrong data

    Ok I figured out my problem, I believe.

    The report that was generated was just a template/place holder. I did not realize I had to build it with the toolbox. I was able to get the data show up when I placed the fields in the details section. It was messy and not what I'm looking for but I believe I can format it to my liking.

  5. #5
    New Member
    Join Date
    Feb 2012
    Posts
    1

    Re: Crystal Reports displaying wrong data

    Hi. I am encountering the same problem that you did but I dont know how to fix it. You said you've solved it but i dont understand your last post. May you please be more specific. thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width