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

DefaultView.RowFilter multiple conditions

Is there any way a datatable, that is populated with te colums Hdate, State1, State2, State3, etc
can be filtered with an OR condition?
The dt is populated by selecting the colums Hdate and State1, State2, State3, StateN.
If the Hdate is valid for that StateX then the StateX = "Y"

For example if the 1 July 2004 is valid for State2 then the Hdate, State1, State2, State3 would look like
1/7/2004, NULL, "Y", Null,etc

the problemm is the following filter does not just include the States selected

dtHolidays.DefaultView.RowFilter = "State1='Y' OR " + sCurrLoc + "='Y'"; where sCurrLoc is State3
the filter shows it as "State1='Y' OR State3='Y'"
but instead of the expect 12 rows returned it returns 13 rows becuase it is including State2 =Y as well.

Any ideas?

--------------------------------
From: Ian Bennett

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>lScPm4VI10eK8M052gaQ0Q==</Id>
Nov 16 '05 #1
0 5272

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

Similar topics

2
by: serge calderara | last post by:
Dear all, I am using a dataview windows application object Form that I need to set the RowFilter property in order to view data based on two different columns values. Querry string is as...
2
by: sandman | last post by:
I'm trying to filter the data as I load a dataset, so I set the RowFilter property of the DataTable's DefaultView. But the dataset still contains all of the records. Is the row filter (and...
0
by: James | last post by:
I have a DataSet with two tables and two datagrids with a Parent/Child Relationship. While that works fine, setting a Rowfilter to the Parent on the parent table defaultview does not. If I use a...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
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...
1
by: hoadley | last post by:
I am filtering a data table using the defaultView.rowFilter but when I filter a column of type "dateTime" it throws an exception saying " operator >= can not be used on type dateTime and type...
6
by: astro | last post by:
I am trying to setup a filter for the dataset on a form as follows: Me.Ds1.Tables("company").DefaultView.RowFilter = "city='New York'" But nothing happens when this code is executed. The same...
0
by: Babak | last post by:
Hi I am trying to find a way to fliter a DefaultView to filter Time Stamp DataTime For example I want to know if there is any row that have Time stmp greater then Today . The Datadiff function...
0
by: Toufik | last post by:
Hi, I've a strange problem, when I execute the code below I've the error "An unhandled exception of type 'System.NullReferenceException' occurred in system.data.dll Additional information: Object...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.