title: Creating a class to interact with a SQL database
body: <p>I'm familiar with the main Object Oriented concepts in programming and currently I'm teaching myself how to design classes.</p>
  
  <p>I have a very simple class calld Company. Here's the code I have so far</p>
  
  <pre><code>using System;
  
  namespace Addressbook
  {
      public class Company
      {
          private string _companyId;
          private string _companyName;
          private string _companyType;
          private string[] _companyDetails;
  
          public Company()
          {
  
          }
  
  
          public string CompanyId
          {
              set
              {
                  this._companyId = value;
              }
          }
  
          public string CompanyName
          {
              set
              {
                  this._companyName = value;
              }
          }
  
          public string CompanyType
          {
              set
              {
                  this._companyType = value;
              }
          }
  
  
          public string[] GetCompanyDetails()
          {
  
              return null;
          }
  
      }
  }
  </code></pre>
  
  <p>What I'm now trying to do is implementing some methods to it and that's where I'm sort of lost.</p>
  
  <p>The first method I'm thinking of is called <code>GetCompanyDetails()</code> which would gather data from a SQL database and then display it. Possibly in a DataGridView or something.</p>
  
  <p>My problem is I can't figure out how I should write this method. Do I put all the SQL queries and connections inside it? Or do I just pass instances of them as parameters? What's the type I should return from the method?</p>
  
  <p>Can someone please give me some guidelines on this?</p>
  
  <p>And also, if you have links to any good tutorials/guides on this subject matter, please post them too.</p>
  
  <p>Thank you.</p>