Assuming this is an SQL database, try:
using (SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
using (SqlCommand com = new SqlCommand("SELECT iD, description FROM myTable", con))
{
using (SqlDataReader reader = com.ExecuteReader())
{
while (reader.Read())
{
int id = (int) reader["iD"];
string desc = (string) reader["description"];
Console.WriteLine("ID: {0}\n {1}", iD, desc);
}
}
}
}
You will need to specify the connection string, but you can get that quite easily.
1) Open the Server Explorer pane in VS
2) Look at the Data Connections list. If your data base is there, skip to step 4
3) Create a connection to your database.
3.1) Right Click "Data Connections", and select "Add Connection..."
3.2) Fill in the dialog that results, until the "Test Connection" button works - can't help you here, way too many variables
3.3) Click OK.
4) Click on the database name to highlight it.
5) In the properties pane, you will find the connection string - you can copy and paste this, but it is a good idea to keep it in the application config file.