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.
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.
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
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
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.