title: C# Datagridview Run "SELECT Raw_Cab.CAB, Count(*) AS Total"
body: <p>I want to run a query over a datagridview1 who is filled with this data:</p>
  <blockquote>
  <p><strong>Nr  Name    Cost</strong></p>
  <p>125   NAME1   1</p>
  <p>126   NAME1   2</p>
  <p>127   NAME1   1</p>
  <p>128   NAME2   1</p>
  <p>129   NAME2   2</p>
  <p>130   NAME4   1</p>
  <p>131   NAME1   1</p>
  </blockquote>
  <p>The data is added programmatically from a external txt source.</p>
  <p>Normally if you use a query and a database the text would be :</p>
  <p><code>SELECT Raw_Cab.Name, Count(*) AS Total FROM Raw_Cab GROUP BY Raw_Cab.Name;</code></p>
  <p>And the result would be</p>
  <blockquote>
  <p><strong>CAB  Total</strong></p>
  <pre><code>NAME1 5
  
  NAME2 3
  
  NAME4 1
  </code></pre>
  </blockquote>
  <p>Is there a way to get the same result but then directly from a datagrid into an object or another datagrid?</p>
  <p>Alex</p>