How can i write this query with LINQ to a FoxPro database?
SELECT count(*) FROM Table group by item1
I wrote it as below, but it doesn't work
Dim Query
Dim dt As New DataTable
Dim da = New Odbc.OdbcDataAdapter("SELECT * FROM table1",connection)
da.Fill(dt)
Query = (From row In dt.AsEnumerable Select row_
Group By item1 = row.Item(6) Into_
count = Count(row.Item(6))).ToList
The following line works:
Dim q = From p In dt Group p By item = p.Item(6) Into count = Count()
How can I bind the results of the above query to a GridView? Unfortunately, setting q
as DataSource doesn't work
grid.DataSource= q
I found that i shoud bind it this way
Dim table As DataTable = q.ToDataTable()
DataGridView1.DataSource = table
but i et error like this
'copytodatatable' is not a member of 'System.Collections.Generic.IEnumerable
what is this error refers to?