I'm working on a C# project which will read a single record from a MySQL database and do some work based on that information. I was thinking of building my SELECT statement with the names of about 30 of the columns which I need to read in and then assign those values to some static variables already formatted in the C# code. Then it dawned on me that 30 columns is almost all of the columns in the database so why not just read all of them in with a much simpler SELECT * statement. Which then brought to mind is there a way to read in this data and have the C# project code create the new variables based on the column names in the database.
For example, I have a column called dwgno in the database. I could create a new variable in the C# code called dwgno to hold the value, or is there a way to have C# understand that the column header names are the exact same names for the variables I want to use in the project and have it create these variables as it reads in from the database?