我正在制作一个Windows Form应用程序,该应用程序读取Firebird数据库并显示数据。
我正在使用DLL文件,该文件是同事推荐的:FirebirdSql.Data.FirebirdClient.dll
这是我如何读取数据的示例:
class FBConnect
{
private FbConnection MyConnection= new FbConnection();
private FbConnectionStringBuilder ConnectionString;
//Constructor
public FBConnect()
{
ConnectionString= new FbConnectionStringBuilder();
{
var withBlock = ConnectionString;
withBlock.Database = "MyFile.fdb";
withBlock.ServerType = FbServerType.Embedded;
withBlock.UserID = "USID";
withBlock.Password = "Key";
withBlock.Pooling = true;
}
MyConnection.ConnectionString = ConnectionString.ToString();
}
public DataTable RunQuery(string query)
{
try
{
MyConnection.Open();
if (MyConnection.State == ConnectionState.Open)
{
DataTable dt = new DataTable();
FbDataAdapter da = new FbDataAdapter(query, MyConnection.ConnectionString);
da.Fill(dt);
return dt;
}
else
{
return null;
}
}
catch (FbException err)
{
MessageBox.Show(err.Message, "Firebird error " + err.ErrorCode, MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
finally
{
MyConnection.Close();
}
}
}
然后,从另一个班级,我打电话给
FBConnect conn = new FBConnect();
dataGridView1.DataSource = conn.RunQuery("SELECT * FROM table1");
它工作正常,我可以看到数据。当我在查询中使用JOIN
时,就会出现问题:然后出现异常
Firebird错误335544854
未安装CHARACTER SET ISO8859_1
这可能是什么原因以及如何解决?
这是我正在使用的查询
SELECT FACTF.CVE_DOC AS "Clave de Documento", VENDEDOR.NOMBRE AS "Nombre del vendedor" FROM FACTF01 FACTF LEFT JOIN VEND01 VENDEDOR ON VENDEDOR.CVE_VEND=FACTF.CVE_VEND