473,805 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL UNION -like filtering of offline DataSet into DataView for WebControl binding

I have an offline DataSet:

id (PK, sorted ASC), firstname, enabled
1, Aaron, true
2, Bill, false
3, Charlie, true
....
10001, Mike, false
10002, Nathan, false

and I need to bind a DataView to a Repeater to fetch something like:

id #2 (I can think of this as a Find)
+
all records whose firstname field contains 'th' (I can think of this as a
Filter)
+
all 'enabled' records whose firstname field don't start with "Mi", in
descending order

a UNION -like query, in other words, but performed using Filtering.

I have read this good article from Hugo Flores:

http://www.codeproject.com/aspnet/Da...&select=670504

but I am still left wondering.. doesn't ADO.NET provide a built-in system of
building multiple DataRows from __DataSet filters__ into a DataView so that
the latter be bound to a Control's DataSource attribute?

The returned records can have the same structure as the ones already in the
DataSet, I don't need to drop/add columns or perform aggregate
calculations..

Anybody already wrestled with this situation? Found any elegant & performing
solutions? (of course I can code iterative data retrieval and population of
a 'new' DataTable - I guess I am looking for a way to 'add' DataViews..
perhaps extending the class and implementing a Union method... :)

Thanks for your help, I can already see this building into a long thread. :)

Nov 18 '05 #1
2 3995
Hi

1. In SQL, UNIONed Results from one table or view can often be presented by concatenating multiple conditions using OR
2. In your case, as long as your results are in one datatable, you can create a dataview to filter out.
like
Dim dv as new DataView(
dv.Table = ds1.Tables(0
dv.RowFilter = "id = 2 OR firstname LIKE '*th*' OR firstname NOT LIKE 'Mi*'
dv.Sort = "firstname DESC
Then you can bind this dataview to your repeater
Hope this help

Bin Song, MCP
Nov 18 '05 #2
Hi Bin Song and thanks for trying to help.. I actually need a reverse sort +
condition checking on the third condition and a normal sort + condition
checking on the second one.. Best wishes, Marco

"Bin Song, MCP" <an*******@disc ussions.microso ft.com> wrote in message
news:F9******** *************** ***********@mic rosoft.com...
Hi,

1. In SQL, UNIONed Results from one table or view can often be presented by concatenating multiple conditions using OR. 2. In your case, as long as your results are in one datatable, you can create a dataview to filter out. like:
Dim dv as new DataView()
dv.Table = ds1.Tables(0)
dv.RowFilter = "id = 2 OR firstname LIKE '*th*' OR firstname NOT LIKE 'Mi*' " dv.Sort = "firstname DESC"
Then you can bind this dataview to your repeater.
Hope this helps

Bin Song, MCP

Nov 18 '05 #3

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

Similar topics

9
5512
by: (Pete Cresswell) | last post by:
I've got some SQL that works as far as returning a recordset from a series of UNION statements. viz: SELECT whatever UNION this UNION that UNION other
3
3577
by: Paradigm | last post by:
I am using Access 2K as a front end to a MYSQL database. I am trying to run a Union query on the MYSQL database. The query is (much simplified) SELECT as ID from faxdata UNION SELECT as ID from letdata UNION SELECT as ID FROM MEMODATA; I get an ODBC error. The same query runs when the backend files are MDB files and it runs with MYSQL if I only combine 2 tables.
6
3335
by: Neil Zanella | last post by:
Hello, I would like to know what the C standards (and in particular the C99 standard) have to say about union initializers with regards to the following code snippet (which compiles fine under gcc 3.2.2 but does not produce the expected results, the expected results being the ones annotated in the comments in the code): #include <stdlib.h>
10
5079
by: Denis Pithon | last post by:
Hi, C lovers! I stuck on an union problem Here is snippet of my code .... /* two pointers of function with repsectively one and two argues */ typedef int (*dce_sn_f)(dce_t*);
73
4075
by: Sean Dolan | last post by:
typedef struct ntt { int type; union { int i; char* s; }; }nt; nt n; n.i = 0;
4
2941
by: Girish | last post by:
I have 2 differesnt defination of same Union as below and a piece of code for printing size of Union and its members.. union U { union U { int i; int j; }a;
18
2383
by: ranjeet.gupta | last post by:
Dear ALL As we know that when we declare the union then we have the size of the union which is the size of the highest data type as in the below case the size should be 4 (For my case and compiler), and it is, what I conclude from the below code union data_type {
16
2111
by: tedu | last post by:
does anyone know of a platform/compiler which will place union elements to not overlap? as in union u { int a; long b; size_t c; }; in my limited experience, writing to any of (a, b, or c) will affect the value read from any other. i understand this is UB, but i'm
30
3291
by: Yevgen Muntyan | last post by:
Hey, Why is it legal to do union U {unsigned char u; int a;}; union U u; u.a = 1; u.u; I tried to find it in the standard, but I only found that
7
6426
by: Peter Olcott | last post by:
Why can a union have a member with a copy constructor?
0
10614
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10369
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10109
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4327
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
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.