Selecting records from DataTable?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to run a select query on DataTable object?

Say for instance, my DataTable had following structure

StudentID, SubjectID, Score

Now, I want list of Score where Score IS NOT NULL

SELECT Score
From TableName
WHERE Score IS NOT NULL
ORDER BY Score

Thanks
 
Job,

You can use for that a
datatable.select 'this is not an SQL query
That returns a collection of datarows

Or a
datatable.defaultview.rowfilter = "score > 0"

the datatable.defaultview you can bind than directly to a datasource.
datagrid.datasource = datatable.defaultview

I hope this helps,

Cor
 
Add a DataView that has a filter to filter out the nulls. Then you can bind
the view to controls in your application.

NOTE: Even when you bind a table you are technically binding a view, as the
DefaultView() is used.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
That will return me array of datarow with all the columns in it. I want to
pull out only Score column without null values.
 
That will return me array of datarow with all the columns in it. I want to
pull out only Score column without null values.
 
Back
Top