I\'m creating a database using SQL Server Management Objects.
I wrote the following method to generate a database:
public static void CreateClientDat
In my case it turned out that the problem is not that the newly created database is not ready. But the problem was that SqlConnection.Open() apparently used a failed cached connection, which then just returned the same error again.
When I call the static SqlConnection.ClearAllPools() method before I try to open the newly created database, it works fine!
See also this question.