views:

11

answers:

1

We are using the SQL Server Data-tier application and I'm having a hard time finding out what the current version a database is at. Is there a way to find it

  1. in SQL Server Management Studio
  2. Via an SQL statement
  3. From .net code

?

Thanks

Mark

A: 

Answer to 3:

            ServerConnection serverConnection;
        string databaseName;

        using (SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
        {
            serverConnection = new ServerConnection(sqlConnection);
            serverConnection.Connect();

            // Assumes default database in connection string is the database we are trying to query.
            databaseName = sqlConnection.Database;
        }

        DacStore dacstore = new DacStore(serverConnection);
        var dacInstance = dacstore.DacInstances[databaseName];
        System.Diagnostics.Debug.Print("Database {0} has Dac pack version {1}.", databaseName, dacInstance.Type.Version);

Still looking for answers to 1 and 2

Thanks

Mark

Mark