Firebird例外:表未知 [英] Firebird exception: Table unknown
问题描述
我可以使用以下连接字符串建立与Firebird数据库的连接:
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;";
但是,当C#代码尝试执行查询时,会出现以下错误:
But when the C# code tries to execute the query the following error comes:
动态SQL错误SQL错误代码= -204 表未知
我尝试过的代码:
using FirebirdSql.Data.FirebirdClient;
...
FbConnection connection = new FbConnection(ConnectionString);
connection.Open();
FbCommand readCommand = new FbCommand("Select Name From Customer;", connection);
FbDataReader myreader = readCommand.ExecuteReader();
肯定存在Customer表(我已经通过IBExpert检查了-因为我可以读取数据).我几乎没有在Google上找到任何东西.
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服务器正在我的计算机上运行.可能是什么问题?
Firebird 2.5 server is running on my Computer. What could be the problem?
推荐答案
正如您在注释中确认表名实际上是"Customer"
一样,您需要在查询中引用对象名称以使其区分大小写,所以:
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);
我假设Name
也是区分大小写的,因此也引用了它.
I have assumed that Name
is also case sensitive, and therefor quoted it as well.
这篇关于Firebird例外:表未知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!