473,587 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's wrong with this filter?

Hello:

I have the following code:

Dim lsFilter As String = Nothing
Select Case rblStatus.Selec tedItem.Value
Case "S"
lsFilter = String.Concat(" D_STAT_CD_C = '", "N'")
Case "R"
lsFilter = String.Concat(" D_STAT_CD_C <> '", "N'")
End Select
If Not lsFilter = Nothing Then
dsMain.Tables(0 ).Select(lsFilt er)
End If

When the value is 'R', it picks up the right filter expression, "D_STAT_CD_ C
<> '", "N'", but the Rowcount of dsMain.Tables(0 ) does not change.

What am I doing wrong?

Venki
Nov 21 '05 #1
2 1184
Hi,

dsMain.Tables(0 ).Select(lsFilt er) will return an array of
datarows. It will not change the count of the datatable.

Ken
------------------
"vvenk" <vv***@discussi ons.microsoft.c om> wrote in message
news:63******** *************** ***********@mic rosoft.com...
Hello:

I have the following code:

Dim lsFilter As String = Nothing
Select Case rblStatus.Selec tedItem.Value
Case "S"
lsFilter = String.Concat(" D_STAT_CD_C = '", "N'")
Case "R"
lsFilter = String.Concat(" D_STAT_CD_C <> '", "N'")
End Select
If Not lsFilter = Nothing Then
dsMain.Tables(0 ).Select(lsFilt er)
End If

When the value is 'R', it picks up the right filter expression,
"D_STAT_CD_ C
<> '", "N'", but the Rowcount of dsMain.Tables(0 ) does not change.

What am I doing wrong?

Venki

Nov 21 '05 #2
On Tue, 11 Oct 2005 14:19:05 -0700, vvenk wrote:
When the value is 'R', it picks up the right filter expression, "D_STAT_CD_ C
<> '", "N'", but the Rowcount of dsMain.Tables(0 ) does not change.

What am I doing wrong?

Venki


What you're doing wrong is expecting the Rowcount of dsMain.Tables(0 ) to
change. dsMain.Tables(0 ).Select(lsFilt er) is a method call that will
return a collection of DataRows, and you are just throwing the return value
away.

You probably want to look into the DefaultView property of a DataTable at
this point. It is where you can set a persistent filter and then check the
rowcount.
Nov 21 '05 #3

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

Similar topics

9
1898
by: jlopes | last post by:
There seems to bet no diff between a vitual method and an inheirited method. class A_Base { public: virtual void filter(){ /* some code */ } }; class D_of_A_Base : public A_Base {
7
3361
by: Vic | last post by:
Dear All, I found this code snippet on this list (taken from a nice webpage of a courteous fellow), which I used to filter a form on a combo box. I wanted to repeat the same code to have an additional combo control doing a different filtering on the same form, and simply copied the code below and changed the appropriate combo names....
1
3621
by: Chris Simmons | last post by:
Hello: I am trying to better understand the HttpResponse.Filter property and, although I think I "get it," I am wondering what is going on behind the scenes. I was initially stumped with the thing because all the samples I came across kept using the property as an argument to the custom filter Stream's constructor. What I then figured...
16
4511
by: raylopez99 | last post by:
I am running out of printing paper trying to debug this...it has to be trivial, but I cannot figure it out--can you? Why am I not printing text, but just the initial string "howdy"? On the screen, when I open a file, the entire contents of the file is in fact being shown...so why can't I print it later? All of this code I am getting from...
0
7920
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8215
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8220
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.