I have access to my MsSQL-Server 2008 if this varaible is 'strServerName=MyServerName\SQLEXPRESS'
but I dont have rights to create a database. "no rights within the master database".
But have rights to create if strServerName = MyServerName
Code:
public static bool IsServerOnline(string strServerName)
        {
            string strCnn = ("data source='" + strServerName + "';integrated security=SSPI");
            SqlConnection server = null;

            try
            {
                server = new SqlConnection(strCnn);
                server.Open();
                return true;
            }

            catch (SqlException ex)
            {
                //ClsMsg.message(ex.Message);
                return false;
            }

            catch (Exception ex)
            {
                //throw new Exception(ex.Message);
                return false;
            }

            finally
            {
                server.Close();
                if (server is IDisposable)
                {
                    (server as IDisposable).Dispose();
                }

                if ((server != null))
                    server = null;
            }