There are many ways to do it. An easy way is to use the SqlConnection, SqlCommand, and SqlDataReader classes but you'll want to study ADO.Net to learn which other methods may be better for you.
Also, refer to
http://www.connectionstrings.com/[
^] which will help you know how to tell your code where the database is.