我使用ASP.NET和C#使用Firebird数据库中的表格创建GridView。但是当我试图阅读我的FbCommand时,我收到了这个错误:
FirebirdSql.Data.FirebirdClient.FbException:' SQLDA错误' ErrorCode 335544583
我使用Firebird 3.0(已经尝试过使用2.5,以及修改firebird.config)。
List<String> columnData = new List<String>();
using (FbConnection connection = new FbConnection("my_connection_string_is_here"))
{
connection.Open();
string query = " select PRONT, NOME, NASC from ricadpac ";
query += " where NOME is not null and NASC is not null ";
if (!String.IsNullOrEmpty(txtNome.Text))
query += String.Format(" and NOME like '{0}' ", txtNome.Text);
if (!String.IsNullOrEmpty(txtDataNasc.Text) && VerificarData(txtDataNasc.Text))
query += String.Format(" and NASC = '{0}' ", txtDataNasc.Text);
query += " order by PRONT ";
using (FbCommand command = new FbCommand(query, connection))
{
using (FbDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
columnData.Add(reader.GetInt32(0).ToString());
columnData.Add(reader.GetString(1));
columnData.Add(reader.GetDateTime(2).ToString());
}
reader.Close();
}
}
connection.Close();
}
连接和命令显然没问题,但ExecuteReader()并没有什么工作。正好在这一行:
using (FbDataReader reader = command.ExecuteReader())