I am going to try to answer what I think your question is which is "how do I structure my code so that the database connectivity is handled in a separate dll?". If this is not the case, then please let me know and i will remove this solution.
What you need is an n-tier architecture and this
Creating ASP.NET Applications with N-Tier Architecture[
^] is one of the millions of articles you can refer to via Google.
Basically, you will have a Business Layer a separate C# class library project i.e. a dll, a Data Access Layer as another separate C# class library project i.e. a dll and a presentation layer typically a web-forms ASP.NET application which will have a dll and aspx pages for the UI. The Data Access Layer (DAL) would be the dll where your data access code will go. If the database server is on another computer (VM or physical), then you would need the appropriate connection string for that machine and make sure your database server is set to allow remote TCP connections. Let me know if this helps or not.
Cheers