Domanda

        string conString = "User=SYSDBA;Password=masterkey;Database=C:\\Users\\dev1\\Desktop\\testdb.fdb;Dialect=3;Charset=UTF8;ServerType=1;";
        FbConnection fcon;

        try
        {
            fcon = new FbConnection(conString);
            string query = "create table test( name varchar(40) );";
            FbCommand cmd = new FbCommand(query, fcon);
            cmd.ExecuteNonQuery();
        }
        catch (Exception e)
        {
            string errstr = e.Message.ToString();
            System.Console.WriteLine("Error: " + errstr);

        }

I only get the error message "Connection must be valid and open"; how do I determine why the connection could not be established exacty?

È stato utile?

Soluzione

You need to call fcon.Open() to open the connection.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top