While you can spend the morning cruising Google or the docs, you might want to save some time by reading my newest book Hitchhiker's Guide to Visual Studio and SQL Server. Both have lots of examples of managing a Connection object--written in terms that anyone can understand.
Before you start building a Connection, you need to choose a provider. Pick one that best matches your data source (SQL Server, Oracle, DB2, OLE DB, ODBC, or whatever). Next, you need to determine how you're going to pass in authentication credentials--the username and password are passed to the ConnectionString. These could be data-source specific or Windows credentials. Next, you have to build this ConnectionString that's designed to set the properties of the Connection object based on the needs of the data source and provider. You also have to Open and Close the connection correctly and in the correct place to prevent the Connection from getting orphaned. You have to be concerned with how the Connection Pool works if you're working with ASP and with MARS if you're working with Windows Forms (or ASP).
All of these are discussed in detail in my new book--I devote an entire chapter to connecting.
I hope it helps.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit
www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)