Select all DataRows of a DataColumn

G

Gordian

Hello,
VS2005 b2
DataTable.Select(string filterExpression)

I want to select all DataRows of a DataColumn.

I tried the like-operator with wildcards* and %.
But the compiler misses the operand.

This behaviour is documented in msdn-docu:
"A wildcard is allowed at the beginning and end of a pattern, or at the
end of a pattern, or at the beginning of a pattern"

"http://msdn.microsoft.com/library/d...fsystemdatadatacolumnclassexpressiontopic.asp

"Syntax error: Missing operand after '*' operator.

The like-operator does only work with string-DataColumns ( I think ).


Greetings
Gordian
 
G

Gordian

Hi Sahil,

I am looking for an expression which does the same
like this SQL

=> "Select jobID from jobTable"

I want all jobID-values of one column in the DataTable without any
filtering.

Greetings & Thanks
Gordian
 
M

Marina

You can't get a subset of the columns from a datatable. It has support for
very very few things that a table in SQL would have - it is not an in memory
database.
 
G

Gordian

Sahil said:
..NET 2.0 has a method called ToTable on DataView that will let you do
"Select jobID from jobTable"

Thanks a lot.
I didn't know this class yet.

Gordian

p.s. I have another question relatet to this, but I will post it with
the following subject:

Howto iterate over objects stored in one column of a DataTable ---- Or
howto get an array, collection, ... of objects stored in one column of a
DataTable
 
C

Cor Ligthert [MVP]

Gordian,

It is very simple

I don't know the language you use and my first is VBNet
\\\
Dim ar as arraylist
For each dr in JobTable.Rows
ar.add(dr(JobId))
Next
///

It can as well with a static array, however than you need the For Index

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top