How to add column named Zone to OleDb?
I assume that "Zone" is a reserved keyword, so can I put it in quotes or something to make this work? My DB connection is good. I've added columns with different names.
String addZone = AL开发者_开发百科TER TABLE Streets ADD COLUMN Zone Text(50)
OleDbCommand com1 = new OleDbCommand(q1, mdbConnection);
com1.ExecuteNonQuery();
Zone is a reserved keyword so you have to wrap it in brackets
String addZone = "ALTER TABLE Streets ADD COLUMN [Zone] Text(50)"
See http://msdn.microsoft.com/en-us/library/aa259228(SQL.80).aspx
For those who are looking for reasons and got here:
ZONE is a reserved ODBC keyword (list of reserved keywords), so need to escape it, for example:
"Zone" - SQL standard
[Zone] - T-SQL
`Zone` - MySQL
精彩评论