If an instance of SQL Server Express is created like this:
Then isn't this classed as an open connection to the database in the connection string?
I am trying to restore a database and before I call the restore code I close the main application connection which allows the user to interact with the database.
But I get an error saying it cannot obtain exclusinve lock on database to restore?
I'm confused then as to how to perform a restore?
Thansk
VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] cnSQLConnection [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] SqlClient.SqlConnection = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] SqlClient.SqlConnection([/SIZE][SIZE=2][COLOR=#0000ff]My[/COLOR][/SIZE][SIZE=2].Settings.MB2007ConnectionString)
cnSQLConnection.Open()
[SIZE=2]scnServerConnection = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Microsoft.SqlServer.Management.Common.ServerConnection(cnSQLConnection)
[/SIZE][SIZE=2][COLOR=#008000]
[/COLOR][/SIZE][SIZE=2]srvAdminServer = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Server(scnServerConnection)
[/SIZE][/SIZE]
Then isn't this classed as an open connection to the database in the connection string?
I am trying to restore a database and before I call the restore code I close the main application connection which allows the user to interact with the database.
But I get an error saying it cannot obtain exclusinve lock on database to restore?
I'm confused then as to how to perform a restore?
Thansk