Boris P Boris P - 4 months ago 10
SQL Question

special character in header of a column in mysql C#

string q="SELECT CONCAT(" + table_users + ".f_name," + table_users + ".l_name) AS Username, (" + table_ship + ".name_it-ITA) AS Lang FROM...";


Hello, I have trouble with this special charachter "-". In PHP I resolve it with backticks, but in C# I cannot resolve it.
Tried with [] and backticks, also with '', but no success.
It would be easier to rename column header name "name_it-ITA", but I cannot do that.
Do you have any idea?

BR

Answer

In mysql you can use always bacticks these are not related to C#

"SELECT CONCAT(" + table_users + ".f_name," + table_users + ".l_name) AS Username, 
 (" + table_ship + ".`name_it-ITA`) AS Lang FROM..."

In mysql all column and table name can wrapped with backtics

Comments