473,395 Members | 1,999 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,395 software developers and data experts.

Help with DataTable RowFilter?

I have a DataTable named _filteredCriteriaTable. In the RowCollection
ItemArray are these values

_filteredCriteriaTable.rowCollection.list._items[0].ItemArray

- ItemArray {Length=4} System.Object[]
[0] "83446" string
[1] "1" string
[2] "1" string
[3] "3" string

The above match one row with four columns from the set I filled this
datatable with. Does this mean the datatable has only one row?

I then want to get only rows that match the following criteria:

_filteredCriteriaTable.DefaultView.RowFilter = "EventName = " +
this.SystemStatus + " AND SampleStatusName = " + this.SampleStatus + "
AND CycleStatusName = " + this.TrackStage;

The above parameters have these values:
this.SystemStatus = 1
this.SampleStatus = 0
this.TrackStage = 1

When I check _filteredCriteriaTable, it still has the same row as
above, which does not match. What are some of the things I could be
doing wrong here?

I then apply this to a datagrid but it remains empty:

this.Participant.DataSource = mymethod.Filter();

which contains the above code and returns a DataTable.

Thanks,
Brett

Jan 3 '06 #1
2 12654
hi what you have to do is to create a view from the table and bind the view

DataView view =_filteredCriteriaTable.DefaultView;
view.RowFilter ="EventName = " +
this.SystemStatus + " AND SampleStatusName = " + this.SampleStatus + "
AND CycleStatusName = " + this.TrackStage;

this.Participant.DataSource=view
--
Ansil
Satyam, Hyderabad

"Brett Romero" wrote:
I have a DataTable named _filteredCriteriaTable. In the RowCollection
ItemArray are these values

_filteredCriteriaTable.rowCollection.list._items[0].ItemArray

- ItemArray {Length=4} System.Object[]
[0] "83446" string
[1] "1" string
[2] "1" string
[3] "3" string

The above match one row with four columns from the set I filled this
datatable with. Does this mean the datatable has only one row?

I then want to get only rows that match the following criteria:

_filteredCriteriaTable.DefaultView.RowFilter = "EventName = " +
this.SystemStatus + " AND SampleStatusName = " + this.SampleStatus + "
AND CycleStatusName = " + this.TrackStage;

The above parameters have these values:
this.SystemStatus = 1
this.SampleStatus = 0
this.TrackStage = 1

When I check _filteredCriteriaTable, it still has the same row as
above, which does not match. What are some of the things I could be
doing wrong here?

I then apply this to a datagrid but it remains empty:

this.Participant.DataSource = mymethod.Filter();

which contains the above code and returns a DataTable.

Thanks,
Brett

Jan 4 '06 #2
I tried your code. There are 278 rows in the original table. After
running the filter, there are still 278 results in the dataview. I
looked at the table object inside view and several rows. Their values
are for the four columns:
[row 1]
1234
1
1
3

[row 2]
1235
1
1
3

The criteria filters on the last three columns. It's values are a=1
AND b=1 AND c=1. Since the last column of each actual row has a three,
these shouldn't be in the view.

I also tried:
DataRow[] rows = _filteredCriteriaDataSet.Tables[0].Select(expression);

which doesn't work with the AND operator. Only the OR, which isn't
what I need.

Brett

Jan 5 '06 #3

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

Similar topics

0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
1
by: werk | last post by:
For limiting access to the database to strictly necessary I try to filter the query by using DataView. Thw DataSet ds contains three columns (fields) : (LAND_ID, Landcode, Landnaam) and four...
3
by: Eric | last post by:
I had a windows form project that had a functions module that could control objects on the referenced main form. How would I do the same with a web project using a web form? See my windows form...
1
by: Jason | last post by:
I've gathered a bunch of data from Active Directory and placed it into a datatable ("ADTable"). I now need to sort and filter this table based on the selection of a drop down list("ddlCategory"). ...
1
by: Gary | last post by:
Hi, I have a DataTable, which will have 2 Columns, one column holds Unique values. I will use DataTable.Select(Unique value) and Filter the Matching rows, After filtering those rows I want...
7
by: Jeff | last post by:
Hi - For my VB.NET app, I have a SQL2K database that I use to create a dataset with multiple data tables. I've created a dataview (dvReportsTo) of one of the tables, SCPMaster, and I've bound a...
3
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
5
by: manmit.walia | last post by:
Hello All, I am stuck on a conversion problem. I am trying to convert my application which is written in VB.NET to C# because the project I am working on currently is being written in C#. I tried...
3
by: kevinwolfe | last post by:
Hi all. I'd like any suggestions on how I can get my data set (not a DataSet) bound to a couple of controls on a form. Let me start by describing what my data looks like. Each entry correlates...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.