Results 1 to 5 of 5
  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2009

    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
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Searching for mendhak

    Re: Crystal Reports displaying wrong data

    What tutorial did you follow?
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

  3. #3
    New Member
    Join Date
    Feb 2010

    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.

    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
    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
    Dim Results As New DataTable()
    viewer.ReportSource = report
    viewer.Visible = True
    End Sub


    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 12:12 PM. Reason: Updating the information - including my code snippet for better analysis

  4. #4
    New Member
    Join Date
    Feb 2010

    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

    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

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.