title: Connect to Quick Books Database with Cobol using ODBC and SQL
body: <p>We are trying to just open a connection to our QB DB and get any data out of it. We managed to achieve it with C#, but translating to CoBOL (a language that is foreign to us) is proving very difficult. Here is the C# code:</p>
  
  <pre><code>class Program {
          static void Main(string[] args)
          {
              var odbcConnection = new OdbcConnection("DSN=QuickBooks Data;DFQ=C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files\\" +
                                                  "ourQuickBooksFile.qbw;OLE DB Services=-2;OpenMode=S");
              odbcConnection.Open();
  
              var odbcDataAdapter = new OdbcDataAdapter("SELECT ListID, FullName, CompanyName FROM Customer", odbcConnection);
              var dataSet = new DataSet();
  
              odbcDataAdapter.Fill(dataSet);
  
              DataRowCollection dataRowCollection = dataSet.Tables[0].Rows;
              foreach (DataRow dataRow in dataRowCollection)
              {
                  Console.WriteLine(dataRow["ListID"] + " " + dataRow["FullName"] + " " + dataRow["CompanyName"]);    
              }
              Console.ReadLine();
              odbcConnection.Close();
  
          }
      }
  </code></pre>
  
  <p>We are open to alternative methods, but the COBOL part is essential.</p>
  
  <p>We are using Windows 10 and GnuCOBOL.</p>