cancel
Showing results for 
Search instead for 
Did you mean: 

VS2013 CR Report returns color names instead of ID#

Former Member
0 Kudos

I have tried several iterations of this report and always end up with the same thing when I preview it.  I can see the data fine through my data connection in Visual Studio 2013 and my application works fine until I try to incorporate a Crystal Report into my application.  I make sure the data source is set correctly but when I run the report, all I ever see is a bunch of garbage data from somewhere that contains a list of colors like, 'silver,green,red,gray,aqua,gray,olive,...' instead of the ID's from the table I selected, along with their corresponding records.  I even tried setting up a 'Parameter Field' linked to my Select Expert', which opens and asks for a value.  I still get those darn colors... What am I doing wrong?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Al,

Those colours are telling you it's default dummy data. I believe it was when using a TTX data source or one of the other legacy data drivers.

Need more info about your report, it's data source and does the data source exist and do you have access to the location at runtime?

Don

Former Member
0 Kudos

I am connecting to SQL Server 2008 r2 and I have it setup in the report, which really has me puzzled. I have worked CR some in the past, not a lot in VS.  When I setup the connection, I can see all of the tables and I select the table I want and when I assigned a Parameter Field, I was able to assign it to the correct field in the table because it came up correctly.  However, when I try to run the report, and I have tried several different things to get it to recognize the data source. It just brings up those darn color fields every time, along with their related garbage.

0 Kudos

Hi Al,

OK that is strange, you are definitely using the wrong client dll and connection code in your app then. Can you paste in the code you are using?

What DB driver are you using, ODBC, OLE DB or a Native client?

Try commenting out the connection code and preview, the viewer should prompt you with the log on UI to connect.

Don

Former Member
0 Kudos

I am connecting to the database through the Visual Studio Data Source with a connection string. I have only modified other applications with reports in them in the past and I've not built one from scratch.  That is why I am having difficulty this first time, here is my button code:


Private Sub btnPrint_Click(sender As Object, e As EventArgs) Handles btnPrint.Click

    Dim frmRep1E As New frmRep1E

    Dim cryRpt As New ReportDocument

    Dim cryStr As String

    cryStr = "rptInfo1.rpt"

    cryRpt.Load("C:\Users\********\Documents\Visual Studio 2013\Projects\RFATrack1.2\RFATrack1.2\" & cryStr & "")

    cryRpt.SetParameterValue("TrackNo1", "Me.TrackNo1.Text")

    frmRep1E.Show(cryRpt)

End Sub

DellSC
Active Contributor
0 Kudos

It looks like you're not ever setting the DataSource for the report.  When you design it you're connecting to the class definition of the data source, when you run the app you have to set it to the actual instance of the data source.

So, between your call to .Load() and the call to .SetParameterValue, you should put something like the following line:

cryRpt.SetDataSource(<data source used in the form>);

-Dell

Answers (0)