V
Vagabond Software
I am parsing column names from text files and building CREATE TABLE and INSERT statements at run-time using these names. I have no control over the data written to the text files.
When building my SQL statements, I bracket all column names (e.g. "[" + name + "]"). However, this doesn't seem to be enough for column names that contain parenthesis. I receive an "Invalid bracketing of name..." error when attempting an ExecuteNonQuery using CommandText with column names containing parenthesis.
Any help or suggestions would be greatly appreciated. Here are the three lines of code that build the part of the command around the column names using StringBuilder:
sbprefix.Append("[");
sbprefix.Append(columnName);
sbprefix.Append("]");
Thanks in advance.
- carl
When building my SQL statements, I bracket all column names (e.g. "[" + name + "]"). However, this doesn't seem to be enough for column names that contain parenthesis. I receive an "Invalid bracketing of name..." error when attempting an ExecuteNonQuery using CommandText with column names containing parenthesis.
Any help or suggestions would be greatly appreciated. Here are the three lines of code that build the part of the command around the column names using StringBuilder:
sbprefix.Append("[");
sbprefix.Append(columnName);
sbprefix.Append("]");
Thanks in advance.
- carl