问题
I could establish the connection to a Firebird database with the following connection string:
ConnectionString = "User ID=SYSDBA;Password=masterkey;Database=localhost:C:\\MyDb\\mydb.FDB;DataSource=localhost;Charset=NONE;";
But when the C# code tries to execute the query the following error comes:
Dynamic SQL Error SQL Error Code = -204 Table unknown
The code that I've tried:
using FirebirdSql.Data.FirebirdClient;
...
FbConnection connection = new FbConnection(ConnectionString);
connection.Open();
FbCommand readCommand = new FbCommand("Select Name From Customer;", connection);
FbDataReader myreader = readCommand.ExecuteReader();
There definitely exists the Customer table (I've checked with IBExpert - in that I can read the data). I hardly found anything on Google.
Firebird 2.5 server is running on my Computer. What could be the problem?
回答1:
As you confirmed in the comments that the table name is actually "Customer"
, you will need to quote the object names in your query to make them case sensitive, so:
new FbCommand("Select \"Name\" From \"Customer\"", connection);
I have assumed that Name
is also case sensitive, and therefor quoted it as well.
来源:https://stackoverflow.com/questions/37369281/firebird-exception-table-unknown