[英]How to code lowercase query oracle 11g in C#?
In this case, I use Oracle 11g and Devexpress. 在这种情况下,我使用Oracle 11g和Devexpress。 I have a table named
Employee
, which has 3 fields (Id, Name, Address). 我有一个名为
Employee
的表,该表具有3个字段(Id,Name,Address)。 When I show data in Navicat using Oracle Query it worked properly. 当我使用Oracle Query在Navicat中显示数据时,它可以正常工作。
SELECT Id, Name, Address FROM Employee
but when i use that query in C#, the query doesn't work, this my code: 但是当我在C#中使用该查询时,该查询不起作用,这是我的代码:
OracleCommand cmd = new OracleCommand();
OracleDataAdapter adp = new OracleDataAdapter(@"SELECT Id, Name, Address FROM Employee", connection.con);
DataSet ds = new DataSet();
adp.Fill(ds, "Employee");
gridControl1.DataSource = ds.Tables[0];
I guess that my oracle query syntax in C# doesn't recognized lowercase syntax. 我猜我在C#中的oracle查询语法无法识别小写语法。 Perhaps must be uppercase.Any suggestion on how to solve this lowercase syntax issue in C#?
也许一定是大写的。关于如何解决C#中的小写语法问题的任何建议?
试试这个代码:
OracleDataAdapter adp = new OracleDataAdapter(@"SELECT ""Id"", ""Name"", ""Address"" FROM ""Employee"" ", connection.con);
ID and NAME are oracle restricted words and shouldn't be used as column names as this can give some problems - maybe that's the case here. ID和NAME是受oracle限制的单词,不应用作列名,因为这可能会带来一些问题-也许就是这种情况。 To explicitly call those column use "", for example:
要显式调用这些列,请使用“”,例如:
SELECT "Id", "Name", Address FROM Employee
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.