Search code examples
sqloledboledbconnectionoledbcommand

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 = ALTER TABLE Streets ADD COLUMN Zone Text(50)
OleDbCommand com1 = new OleDbCommand(q1, mdbConnection);
com1.ExecuteNonQuery();

Solution

  • Zone is a reserved keyword so you have to wrap it in brackets

    String addZone = "ALTER TABLE Streets ADD COLUMN [Zone] Text(50)"