小编Don*_*uan的帖子

连接到Firebird 3的C#程序中的"远程接口拒绝连接"

从Firebird 2.5迁移到3.0后,当我尝试使用C#程序测试数据库的连接时,会出现此错误"远程接口拒绝连接".

这是测试连接的代码,当我尝试连接到firebird 2.5数据库时,我使用此代码.

txtPassword.Properties.UseSystemPasswordChar = true;
txtHostname.Text = Properties.Settings.Default.server;
txtUsername.Text = Properties.Settings.Default.user;
txtPassword.Text = Properties.Settings.Default.pass;
txtDBPath.Text = Properties.Settings.Default.dbpath;

void Testdbconn()
{
    try
    {
        var testInMemUnicode =
            String.Format("DataSource={0};Database={1};User ID={2};Password={3}; Charset=NONE;",
                          txtHostname.Text,
                          txtHostname.Text + ":" + txtDBPath.Text.Trim(),
                          txtUsername.Text,
                          txtPassword.Text);
        var testConnParam = new FbConnection(testInMemUnicode);
        testConnParam.Open();
        XtraMessageBox.Show(@"Connection to the server is successful.", @"Data Server Test",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);

    }
    catch (Exception errorCode)
    {
        XtraMessageBox.Show(@"Error in connection: " + errorCode.Message,
                            @"Server Error",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation);
    }
}

class ClsConnection
{
    public static string FirebirdSQL = …
Run Code Online (Sandbox Code Playgroud)

c# firebird firebird-3.0

1
推荐指数
1
解决办法
1571
查看次数

标签 统计

c# ×1

firebird ×1

firebird-3.0 ×1