If I understand the question correctly, the problem is in fetching the data from the database. If that's correct, there are quite a few articles with different kinds of examples covering different kinds of situations. For example, have a look at
Properly executing database operations[
^]. What comes to the connection string, you can store it in app.config or any place it feels reasonable.