DatabaseProvider.TestConnection Method

IIS 7.0

Tests a connection string for a database provider.

Namespace:  Microsoft.Web.Management.DatabaseManager
Assembly:  Microsoft.Web.Management.DatabaseManager (in Microsoft.Web.Management.DatabaseManager.dll)

public abstract void TestConnection(
	string connectionString
)

Parameters

connectionString
Type: System.String
The connection string to test.

Your provider must implement the TestConnection method in order to test the database connection for your provider.

The following code sample illustrates an example TestConnection method that opens and closes a database that will test the connection.



        public override void TestConnection(
            string connectionString )
        {
            using (OleDbConnection connection = new OleDbConnection(connectionString))
            {
                connection.Open();
                connection.Close();
            }
        }



Show: