Try Dim cmd As OleDbCommand = New OleDbCommand("SELECT (Select COUNT(PROJECT) FROM table1 WHERE PROJECT=FOREST as Project12Count)", con) opendatabase() Dim myDA As OleDbDataAdapter = New OleDbDataAdapter(cmd) Dim myDataSet As DataSet = New DataSet() myDA.Fill(myDataSet, "MyTable95") DataGridView1.DataSource = myDataSet.Tables("MyTable95").DefaultView closedatabase() Catch ex As Exception MessageBox.Show(ex.ToString) Finally closedatabase() End Try
SELECT Project, COUNT(Project) FROM Table1 GROUP BY Project
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)