Answers for "- $exception {"Fill: SelectCommand.Connection property has not been initialized."} System.InvalidOperationException"

0

- $exception {"Fill: SelectCommand.Connection property has not been initialized."} System.InvalidOperationException

/// <summary>
/// Test that the server is connected
/// </summary>
/// <param name="connectionString">The connection string</param>
/// <returns>true if the connection is opened</returns>
private static bool IsServerConnected(string connectionString)
{
    using (SqlConnection connection = new SqlConnection(connectionString))
    {
        try
        {
            connection.Open();
            return true;
        }
        catch (SqlException)
        {
            return false;
        }
    }
}
Posted by: Guest on September-21-2021

Code answers related to "- $exception {"Fill: SelectCommand.Connection property has not been initialized."} System.InvalidOperationException"

Browse Popular Code Answers by Language