Hi all
I just started using Crystal reports in vs2010.
I have created a Dataset in the Designer and pulled data from an access DB.
The dataset is being populated fine.
My Issue is when I assign the dataset to crystal database expert and drag the columns to the report no data was displayed.
So intead applying multiple columns to CR I only assigned one and this column displays data, but the data is wrong it displays colors and I don't have any table with colors in my DB.
I'm wondering if I need to change any settings to have CR working on VS2010 assuming it's free to use.
Thanks in advance.

Recommended Answers

All 6 Replies

Use CrystalReport Wizard, there you can find the proper way..

I did use the CrystalReport Wizard, but instead of connecting directly to the data base I connected to the dataset.

Are you using a join or something similar in pulling your data or using an alias on some of your columns? Crystal report is sensitive on column names try to use alias if you are using join to match the column name in your crystal report.

Ex. You have ID column in your Crystal Report and 2 tables joined together or you just have 2 tables in your select query (select column_name from table1, table2) and you want to see all ID in your crystal report from 2 tables. You can't just call ID in your select query because there is another ID column on another table instead you will need to state like table1.ID or table2.ID but because of this neither of them will be shown due to different column name. The solution for this is use an alias like table1.ID as ID or table2.ID as ID.

No this is being pulled from one View.
I have tried populating the dataSet at runtime the datagridview.datasourse=the dataset and all data seams to be good.
But I get he error "Column '' does not belong to table finishrelation_qry"
at this line objRpt.SetDataSource("ds.finishrelation_qry")
Here is the Code

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim DB As New Connection
        Try
            Dim ds As New ds_Rel
            Dim dt As New DataTable
            Dim adapter As New OleDbDataAdapter
            Dim objRpt As New crReport
            Dim cmd As New OleDb.OleDbCommand
            Dim SelectString As String = "Select Species_Name,Door,Name,Line From finishrelation_qry"
            DB.FilePath = "C:\Estimating\DBServerConnection access.txt"
            DB.Password = ""

            DB.connect()
            DB.con.Open()
            With cmd
                .CommandType = CommandType.Text
                .CommandText = SelectString
                .Connection = DB.con
                adapter = New OleDbDataAdapter(cmd)
                adapter.Fill(ds, "finishrelation_qry")

            End With
             DataGridView1.DataSource = ds.finishrelation_qry
            objRpt = New crReport
            objRpt.SetDataSource("ds.finishrelation_qry")
            CrystalReportViewer1.ReportSource = objRpt
            CrystalReportViewer1.Refresh()

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        DB.con.Close()

    End Sub

on line 25
instead of objRpt.SetDataSource("ds.finishrelation_qry")
try objRpt.SetDataSource("finishrelation_qry")
"ds" is not part of your table name.

Thanks Otep for reply!
Now with that change I receive this error "Column '' does not belong to table finishrelation_qry"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.