yourYou created public properties for
- UserName
- Password
- Server
- Database
but you shouldn't allow these things to be editable by other objects
these are things that need to be hidden from everyone except this class, the consumer of this class should not know what these values are, or be allowed to change them without following a strict set of rules defined in the class itself
I think that what you want is a protected property, something that is only available to the class and any class that inherits the class.
the Server property would look like this:
Protected Property Server
Get
Return _Server
End Get
Set
_Server = Value
End Set
End Property
Your function that gets the connection string needs to be renamed, it is not connecting the server all by itself, it is returning a connection string. I suggest: GetConnectionString
or something like that