Gali
Gali

Reputation: 14953

select query on dataset in winforms program throw me an error

i have dataset in my C# program and i try to run query

DataRow[] drTitles = dsConf.Tables[1].Select("Distinct SNum");

but i got error

Syntax error: Missing operand after 'SNum' operator

Upvotes: 0

Views: 456

Answers (2)

DeveloperX
DeveloperX

Reputation: 4683

Select is for filtering use to table in data view to get distinct row Use this syntax

System.Data.DataView dv = new System.Data.DataView(dsConf.Tables[1]);
System.Data.DataTable dt = dv.ToTable(true,"SNum");

Upvotes: 2

misha
misha

Reputation: 2889

This Select is not equivalent to the select clause used in SQL. Here, the role of the Select method is to filter, so you need to specify a filter parameter, like "Name = 'Cindy'". Read more here.

Upvotes: 1

Related Questions