DoLoop
DoLoop

Reputation: 125

Firebird SqlConnection

I have problem with connecting to firebird tables. I tried every connection string i could find on internet but it doesn't work. Problem comes when i open connection

Here is code

    private void RutinskiPopis_Load(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"User ID=sysdba;Password=masterkey;Database=localhost:D:\\TDWORK.FDB;Data Source=localhost;");
        SqlCommand cmd = new SqlCommand("SELECT Opis, Broj FROM PLNAZIVI", con);

        con.Open();
        SqlDataReader dr = cmd.ExecuteReader();

        while (dr.Read())
        {
            comboBox1_Data((IDataRecord)dr);
        }
        con.Close();
    }

Can anyone help me with that connection string? Here is full connection string

initial catalog=D:\TDWORK.FDB;data source=localhost;user id=SYSDBA;role=admin

Upvotes: 0

Views: 709

Answers (2)

Mark Rotteveel
Mark Rotteveel

Reputation: 108941

The problem is that you are using SqlConnection, which can only connect to Microsoft SQL Server. For Firebird you need to use FbConnection.

See for examples: .NET - examples of use.

Upvotes: 1

DoLoop
DoLoop

Reputation: 125

I solved this by using FbConnection instead of SqlConnection, and then using standard firebird connection string.

Upvotes: 0

Related Questions