Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9211035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:12:23+00:00 2026-06-18T01:12:23+00:00

Ladies & Gentlemen, I have been, thus far, successful in programmatically pulling records from

  • 0

Ladies & Gentlemen,

I have been, thus far, successful in programmatically pulling records from a MySQL database to create a crystal report from a single table. Using the code below, I’m trying to join two tables and display their matched records on the report:

    Try
        Dim myConnectionString As String = "Server=" & FormLogin.ComboBoxServerIP.SelectedItem & ";Port=3306;Uid=parts;Password=parts;Database=accounting;"
        Dim dbConn As New MySqlConnection(myConnectionString)
        Dim dbQuery As String = "SELECT * " & _
                                "FROM cc_master a JOIN customer b ON b.accountNumber = a.customer_accountNumber;"
        Dim dbAdapter As New MySqlDataAdapter(dbQuery, dbConn)
        Dim dbTable As New DataTable
        dbAdapter.Fill(dbTable)
        Dim report As New rptCardListAll
        report.SetDataSource(dbTable)
        CrystalReportViewer1.ReportSource = report
        CrystalReportViewer1.Zoom(1)
    Catch ex As Exception
        'MsgBox(ex.Message)
    End Try

The problem I’m running into now is that when the report runs at run-time, all the db records are populated on the report except for the one field that I’m pulling from the CUSTOMER table. Below is a screen shot. Notice the blank CUSTOMER NAME – this shouldn’t be blank because I know for a fact there’s data in that field for every record.

The query works fine when I run it directly on the DB using MySQL Workbench, so I can’t figure out why the report won’t pull the requested information. Any help would be appreciated, thanks.

Report Snapshot

EDIT: Screenshot showing DataSet Visualizer during debug containing the missing field (nameCOMPANY)

Report Snapshot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:12:24+00:00Added an answer on June 18, 2026 at 1:12 am

    Good evening all,

    So after hours of reading and searching the web, I’ve managed to arrive at or better yet, discover, a solution to my problem.

    It appears that even though I’d created a DataSet within VS and used that to create my CR Report, I wasn’t actually using that DataSet in code. Instead what I was doing was creating a new DataTable at run-time, filling that with my query result, and setting the report’s datasource property to it.

    What I should have been doing was to create an instance of my DataSet (the one I created earlier and used to design the report), fill it with my query result, and set the report’s datasource property to it. This allowed CR to recognize and respect the table links/relationships I established earlier in the DataSet designer. I also learned that when using the DataAdapter with a query that returns multiple tables, the default naming convention is “Table” then “Table1” and so forth – that it was necessary to map these to the actual names of my tables in the DB.

    So after applying all these lessons, I had to re-do my code as follows:

        Dim report As New rptCardListAll
        Dim myConnectionString As String = "Server=" & FormLogin.ComboBoxServerIP.SelectedItem & ";Port=3306;Uid=parts;Password=parts;Database=accounting;"
        Dim dbConn As New MySqlConnection(myConnectionString)
        Dim dbQuery As String = "SELECT * FROM cc_master; " & _
                                "SELECT * FROM customer;"
        Dim dbAdapter As New MySqlDataAdapter(dbQuery, dbConn)
        With dbAdapter
            .TableMappings.Add("Table", "cc_master")
            .TableMappings.Add("Table1", "customer")
        End With
        Try
            Dim dbDataSet As New accountingDataSet
            dbAdapter.Fill(dbDataSet)
            report.SetDataSource(dbDataSet)
            CrystalReportViewer1.ReportSource = report
            CrystalReportViewer1.Zoom(1)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkOnly, "An Error Has Occured....")
        End Try
    

    My report now shows the missing field “nameCOMPANY” from the customer table.

    CREDIT:
    I want to thank @halfer, @luchosrock, and @EvilBob22 for their assistance. Also, I give credit to the authors in the following documents:

    http://developer-content.emc.com/developer/downloads/CrystalReport_ADO_Dataset.pdf

    How to fill Dataset with multiple tables?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ladies & Gentlemen, Short Version: Trying to dynamically create a Spine Model Class. Basically
Ladies and gentlemen, I'm stuck. I've been pondering this (and obviously have failed since
Ladies and Gentlemen, For quite a long time now, I've been using the following
Good evening ladies and gentlemen, I have a problem with Java Swing that I
Ladies and Gents, I have a very simple grails app from which I need
Ladies & Gentlemen, I´m new to Java, forgive me if it´s obvious, but I
ladies and gentlemen! Very often on my job I meet the following requirement from
Ladies and Gentlemen, Using javascript, how do I access 'id' in a JSON string
Good evening ladies and gentlemen! Searching for a cross-browser solution to embed commercial fonts
Ladies and gents, I have a CRM page which references 3 js files, (1x

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.