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 7191147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:40:02+00:00 2026-05-28T19:40:02+00:00

Found a bunch of other threads about comboboxes in WPF datagrid, but none that

  • 0

Found a bunch of other threads about comboboxes in WPF datagrid, but none that helped.

I have a connection to a MySQL database, and can populate a datagrid with the rows from a table. XAML:

<DataGrid Name="dataGridxxx" ItemsSource="{Binding}" AutoGenerateColumns="True"  Height="279" AutoGeneratingColumn="dataGridxxx_AutoGeneratingColumn">

C#:

private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string MyConString =
            "SERVER=xxx;" +
            "DATABASE=xxx;" +
            "UID=xxx;" +
            "PASSWORD=xxx;";

            string sql = "SELECT * FROM xxx ORDER BY lastName";

            using (MySqlConnection connection = new MySqlConnection(MyConString))
            {
                connection.Open();
                using (MySqlCommand cmdSel = new MySqlCommand(sql, connection))
                {
                    DataTable dt = new DataTable();
                    MySqlDataAdapter da = new MySqlDataAdapter(cmdSel);
                    da.Fill(dt);
                    dataGridPatients.DataContext = dt;
                }

                connection.Close();
            }
        }

Now I have a “Province” field in the table, and it was made an enum(‘ON’, ‘MB’, ‘SK’, etc.) in MySQL workbench. When I create the data connection in VS, I can see that VS sees it’s an enum type. I thought if the AutoGenerateColumns was set to true, the grid is smart enough to put a combobox with the DB enum values in those Province table cells? That’s not happening. It’s just a plain old text field, with maxchars of 2…

Any ideas? Do I have to create a new DataSet in my project to create C# classes from my database schema?

  • 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-05-28T19:40:03+00:00Added an answer on May 28, 2026 at 7:40 pm

    The correct answer is in H.B.’s referenced post… “don’t use them”. Seeing as I’m new to databases as well, I didn’t know the proper and standard way of handling enums is by using a reference table. Snagged the link from a few clicks away: Why MySQL enums are evil

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

Sidebar

Related Questions

I found a bunch of other questions about this topic, but for some reason
I've got a site that I just published and have just found a bunch
I've found a bunch of map_reduce tutorials around, but none of them seem to
found this little code snippet that seems to do what i want, but im
I have a form which contains a whole bunch of checkboxes and some other
I have searched SO, for similar and I found one other posting similar to
I have a bunch of static Strings that I'd like to store in a
I have a bunch of MKPolygon saved in an array, but I wanted to
I know similar questions have been asked before, but I can't find one that
I have a bunch of UIViews stacked one upon the other(not nested). I want

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.