Searching thru a dataset

  • Thread starter Thread starter Arsalan
  • Start date Start date
A

Arsalan

How do I search row values in the dataset?
is there any function to do it? suppose i've two columns named 'item' &
'price'

I want to search a table which have been filled in the dataset for
item="Cor" price=1500 ? [I cant execute SQL statement directly because there
might be some modified data in the dataset which have not yet been updated
using Adapter's update commnad]
 
Hi,

Use either DataTable.Select or create a DataView on the table with filter
applied.
 
An example would be really helpful, i guess filter expression can hold only
simple condition, how do I go for complex conditions?
Miha Markic said:
Hi,

Use either DataTable.Select or create a DataView on the table with filter
applied.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Arsalan said:
How do I search row values in the dataset?
is there any function to do it? suppose i've two columns named 'item' &
'price'

I want to search a table which have been filled in the dataset for
item="Cor" price=1500 ? [I cant execute SQL statement directly because
there might be some modified data in the dataset which have not yet been
updated using Adapter's update commnad]
 
Hi Arsalan,

You will find filtering capabilites in the
DataColumn.Expression
..net help file.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Arsalan said:
An example would be really helpful, i guess filter expression can hold
only simple condition, how do I go for complex conditions?
Miha Markic said:
Hi,

Use either DataTable.Select or create a DataView on the table with filter
applied.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Arsalan said:
How do I search row values in the dataset?
is there any function to do it? suppose i've two columns named 'item' &
'price'

I want to search a table which have been filled in the dataset for
item="Cor" price=1500 ? [I cant execute SQL statement directly because
there might be some modified data in the dataset which have not yet been
updated using Adapter's update commnad]
 
Can someone show me how to use multiple expressions, for e.g price=1000 and
ID=10
MSDN has simple one for e.g filtering only one field

Miha Markic said:
Hi Arsalan,

You will find filtering capabilites in the
DataColumn.Expression
.net help file.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Arsalan said:
An example would be really helpful, i guess filter expression can hold
only simple condition, how do I go for complex conditions?
Miha Markic said:
Hi,

Use either DataTable.Select or create a DataView on the table with
filter applied.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

How do I search row values in the dataset?
is there any function to do it? suppose i've two columns named 'item' &
'price'

I want to search a table which have been filled in the dataset for
item="Cor" price=1500 ? [I cant execute SQL statement directly because
there might be some modified data in the dataset which have not yet
been updated using Adapter's update commnad]
 
Arsalan,

You can use in a rowfilter (and in a select statements) something as

..rowfilter = "item = 'Miha' AND price = 6000"

This selecting a rowcollection, when you want a datarow.position in your
dataview than you have to use the dataview.find, however that is acting
completly different.

Be aware that the names are the columnnames from your datatable and that I
am not sure if this is case sensitive and therefore do it always as case
sensitive.

Cor
 
Shees, Arsalan.
Is that difficult to open help file, typeing DataColumn.Expression and read
the content?
Excerpt:
"OPERATORS

Concatenation is allowed using Boolean AND, OR, and NOT operators. You can
use parentheses to group clauses and force precedence. The AND operator has
precedence over other operators. For example:

(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'"


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Arsalan said:
Can someone show me how to use multiple expressions, for e.g price=1000
and ID=10
MSDN has simple one for e.g filtering only one field

Miha Markic said:
Hi Arsalan,

You will find filtering capabilites in the
DataColumn.Expression
.net help file.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Arsalan said:
An example would be really helpful, i guess filter expression can hold
only simple condition, how do I go for complex conditions?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi,

Use either DataTable.Select or create a DataView on the table with
filter applied.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

How do I search row values in the dataset?
is there any function to do it? suppose i've two columns named 'item'
& 'price'

I want to search a table which have been filled in the dataset for
item="Cor" price=1500 ? [I cant execute SQL statement directly because
there might be some modified data in the dataset which have not yet
been updated using Adapter's update commnad]
 
Man, it was really difficult for me to open the help file
Miha Markic said:
Shees, Arsalan.
Is that difficult to open help file, typeing DataColumn.Expression and
read the content?
Excerpt:
"OPERATORS

Concatenation is allowed using Boolean AND, OR, and NOT operators. You can
use parentheses to group clauses and force precedence. The AND operator
has precedence over other operators. For example:

(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'"


--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

Arsalan said:
Can someone show me how to use multiple expressions, for e.g price=1000
and ID=10
MSDN has simple one for e.g filtering only one field

Miha Markic said:
Hi Arsalan,

You will find filtering capabilites in the
DataColumn.Expression
.net help file.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

An example would be really helpful, i guess filter expression can hold
only simple condition, how do I go for complex conditions?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
Hi,

Use either DataTable.Select or create a DataView on the table with
filter applied.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
SLODUG - Slovene Developer Users Group www.codezone-si.info

How do I search row values in the dataset?
is there any function to do it? suppose i've two columns named 'item'
& 'price'

I want to search a table which have been filled in the dataset for
item="Cor" price=1500 ? [I cant execute SQL statement directly
because there might be some modified data in the dataset which have
not yet been updated using Adapter's update commnad]
 
Back
Top