Having much troubles with COUNT DISTINCT since yesterday and I can't find any solution on the internet. The weird thing is that I have several errors, but never on the same time. When I think I solved something another error pops.

The SQL-command:
Code:
Dim cmd_plaats As New SqlCeCommand("SELECT DISTINCT plaats FROM beslagdata", connStr)
Dim cmd_count_plaats As New SqlCeCommand("SELECT COUNT (plaats) FROM (SELECT DISTINCT plaats FROM beslagdata)", connStr)
Code:
With frm_main.ts_progress
    .Value = 0   '  reset the value
    .Maximum = Convert.ToInt32(cmd_count_plaats.ExecuteScalar)    '   count the records
End With
Details:
Code:
{"There was an error parsing the query. [ Token line number = 1,Token line offset = 68,Token in error = ) ]"}
Very frustrating. Hope someone sees and could tell me what I'm doing wrong.