473,385 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Selecting records from DataTable?

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

Nov 22 '05 #1
8 4093
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
Nov 22 '05 #2
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
Nov 22 '05 #3
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!
***************************
"Job Lot" wrote:
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

Nov 22 '05 #4
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!
***************************
"Job Lot" wrote:
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

Nov 22 '05 #5
That will return me array of datarow with all the columns in it. I want to
pull out only Score column without null values.

"Cowboy (Gregory A. Beamer) - MVP" wrote:
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!
***************************
"Job Lot" wrote:
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

Nov 22 '05 #6
That will return me array of datarow with all the columns in it. I want to
pull out only Score column without null values.

"Cowboy (Gregory A. Beamer) - MVP" wrote:
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!
***************************
"Job Lot" wrote:
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

Nov 22 '05 #7
That will return me array of datarow with all the columns in it. I want to
pull out only Score column without null values.

"Cor Ligthert" wrote:
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

Nov 22 '05 #8
That will return me array of datarow with all the columns in it. I want to
pull out only Score column without null values.

"Cor Ligthert" wrote:
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

Nov 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Job Lot | last post by:
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...
2
by: JC | last post by:
Hi, I have a database that imports 4 reports to my "data" table, each report has its own identifier. Then I have a table with Analysts with the report identifier that they are to be assigned to. ...
1
by: Ramesh | last post by:
hi, I am selecting fields from three table for manupulating data and i want to display total number of records selected. But i am always getting -1 value, eventhough 1000 of records are selected....
6
by: aaj | last post by:
Hi all I use a data adapter to read numerous tables in to a dataset. The dataset holds tables which in turn holds full details of the records i.e. keys, extra colums etc.. In some cases I...
4
by: rodchar | last post by:
Hey all, Is there a way to get similar functionality as the SELECT DISTINCT records in a SQL Statement when selecting records from a dataset? thanks, rodchar
11
by: Ron L | last post by:
I have a data table that lists a series of items in my database. In my user form, I want the user to be able to filter by a number of criteria (e.g. location, contract, date modified, etc). Other...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
Greetings, I have to load 30,000 unique names into a combox. Filling a dataTable takes only a few milliseconds. But populating the combobox and displaying the list takes several seconds - way...
5
by: Nathan Sokalski | last post by:
I want to select only the first n records from a database using VB.NET. I have declared a DataTable and OleDB.OleDbDataAdapter as follows: Dim linkstable As New DataTable Dim linksadapter As New...
0
by: StefanPienaar | last post by:
Hi Guys Is there any way in c# (or vb.net) to extract a datatable of data from a dataset with multiple datatables which has relationships set up (containing combined data from the datatables)? ...
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.