Hi all,

I've 2 tables in a DataSet.
The first table is "ARTICLE"
The second is called "SELECTION"
The column "ART_CODE" is the primary key for the two tables

Problem :
I want to get the articles which aren't in SELECTION

What I do :
...
string where =
" ( ART_CODE not in ( select ART_CODE in SELECTION ) )";

// m_ds is a DataSet
DataTable dt = this.m_ds.Tables[ "ARTICLE" ];
DataRow[] drs = dt.Select( where, "ART_CODE" );

this.lvDisponible.Items.Clear();

foreach( DataRow dr in drs )
{
ListViewItem lvi =
new ListViewItem(
new string[]
{
dr[ "ART_CODE" ].ToString(),
dr[ "ART_LABEL" ].ToString()
} );
lvDisponible.Items.Add( lvi );
}

Error :
ADO.net doesn't recognize the word 'ART_CODE'
I get this message: "opérande manquant après l'opérateur 'ART_CODE'."
It's in French, sorry :-(
And sorry too for my poor english :-(

Notes:
- The code works fine if I don't have the condition "where"


Do you have a solution ? Is it possible to do something like a "NOT IN" with
a DataSet ?

Thank you very much in advance !!!

Laura

Re: Dataset problem... by Miha

Miha
Wed Apr 28 06:48:01 CDT 2004

Hi newbie,

"select" keyword won't work within filter statament (see
DataColumn.Expressions .net help topic of possible combinations).
You'll have to put in all key values that you don't want to see....

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"newbie" <newbie@newbie.corp> wrote in message
news:408f8429$0$17619$636a15ce@news.free.fr...
> Hi all,
>
> I've 2 tables in a DataSet.
> The first table is "ARTICLE"
> The second is called "SELECTION"
> The column "ART_CODE" is the primary key for the two tables
>
> Problem :
> I want to get the articles which aren't in SELECTION
>
> What I do :
> ...
> string where =
> " ( ART_CODE not in ( select ART_CODE in SELECTION ) )";
>
> // m_ds is a DataSet
> DataTable dt = this.m_ds.Tables[ "ARTICLE" ];
> DataRow[] drs = dt.Select( where, "ART_CODE" );
>
> this.lvDisponible.Items.Clear();
>
> foreach( DataRow dr in drs )
> {
> ListViewItem lvi =
> new ListViewItem(
> new string[]
> {
> dr[ "ART_CODE" ].ToString(),
> dr[ "ART_LABEL" ].ToString()
> } );
> lvDisponible.Items.Add( lvi );
> }
>
> Error :
> ADO.net doesn't recognize the word 'ART_CODE'
> I get this message: "opérande manquant après l'opérateur 'ART_CODE'."
> It's in French, sorry :-(
> And sorry too for my poor english :-(
>
> Notes:
> - The code works fine if I don't have the condition "where"
>
>
> Do you have a solution ? Is it possible to do something like a "NOT IN"
with
> a DataSet ?
>
> Thank you very much in advance !!!
>
> Laura
>
>