---
title: "'Procent.Data.Master.connectionString' is inaccessible due to its protection level"
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/137354-procent-data-master-connectionstring-is-inaccessible-due-to-its-protection-level"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "doggelito"
published: "2005-11-10T10:08:36.000Z"
updated: "2005-11-10T11:50:20.000Z"
replies: 4
views: 470
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/137354-procent-data-master-connectionstring-is-inaccessible-due-to-its-protection-level"
---

# 'Procent.Data.Master.connectionString' is inaccessible due to its protection level

## #1 — doggelito, 2005-11-10T10:08Z

Vad gör jag för fel?

```
namespace Procent.Data
{
    public class Master
    {
        private string connectionString;
        public string ConnectionString
        {
            get
            {
                return connectionString;
            }
            set
            {
                connectionString = value;
            }
        }
    }

    public class SqlServer : Master
    {
        public SqlConnection GetConn()
        {
            SqlConnection myConnection = new SqlConnection();
            myConnection.ConnectionString = [B]connectionString[/B];
            return myConnection;
        }
    }
}
```

Permalänk: https://www.webforum.nu/p/137354

## #2 — Dino, 2005-11-10T10:20Z

"connectionString" är private. 

```
myConnection.ConnectionString = [B]C[/B]onnectionString;
```

Permalänk: https://www.webforum.nu/p/1704824

## #3 — doggelito, 2005-11-10T10:36Z

kanske bara jag som snurrat till det :) men ska man inte komma åt en privat sträng i basklassen när den ärvs ner i underklassen?

Permalänk: https://www.webforum.nu/p/1704834

## #4 — Dino, 2005-11-10T10:43Z

Nej. 
Läs mer [här](http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfprivatepg.asp).

Permalänk: https://www.webforum.nu/p/1704837

## #5 — doggelito, 2005-11-10T11:50Z

har läst på lite; ändrade private till protected! :)

Permalänk: https://www.webforum.nu/p/1704927

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/137354-procent-data-master-connectionstring-is-inaccessible-due-to-its-protection-level
