aminvincent
aminvincent

Reputation: 603

How to code lowercase query oracle 11g in C#?

In this case, I use Oracle 11g and Devexpress. I have a table named Employee, which has 3 fields (Id, Name, Address). When I show data in Navicat using Oracle Query it worked properly.

SELECT Id, Name, Address FROM Employee 

but when i use that query in C#, the query doesn't work, this my code:

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. Perhaps must be uppercase.Any suggestion on how to solve this lowercase syntax issue in C#?

Upvotes: 1

Views: 145

Answers (3)

Jemo
Jemo

Reputation: 117

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. To explicitly call those column use "", for example:

SELECT "Id", "Name", Address FROM Employee 

Upvotes: 0

Alfian Yagami
Alfian Yagami

Reputation: 28

try this code :

OracleDataAdapter adp = new OracleDataAdapter(@"SELECT ""Id"", ""Name"", ""Address"" FROM ""Employee"" ", connection.con);

Upvotes: 1

Ebad Masood
Ebad Masood

Reputation: 2379

ORA-00904 error means that a column name is invalid or missing. Please correct your query.

Upvotes: 0

Related Questions