❔ Best practice to retrieve MySQL columns
Hello wonderful people!
Can you please help me understanding what would be the best practice to retrieve values of specific columns when I use MySQL query?
Currently, I just hardcode names but this doesn't seem to be the ideal situation.
I see that I can create an enum for the names and use Enum.Login.ToString()
Or
I can index it (like reader[0])
But both options has its flows as I can change the column name / change the order.
What is the best practice to get specific columns? Or what method you personally use for a smaller scale application?
2 Replies