开发者

How to add column named Zone to OleDb?

开发者 https://www.devze.com 2023-02-08 20:58 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消