HighTechTalks DotNet Forums  

Why DataTable.Select("IIF(...)") is refused !

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Why DataTable.Select("IIF(...)") is refused ! in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
sam
 
Posts: n/a

Default Why DataTable.Select("IIF(...)") is refused ! - 08-18-2007 , 03:31 PM






Why using an IIF in a DataTable.Select(IIF("column1=zz",
"column2","column3")); is in invalid context ?
What is the way for using an IIF in a Datatable.Select(...) ?

Thanks for help.

sam




Reply With Quote
  #2  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Why DataTable.Select("IIF(...)") is refused ! - 08-18-2007 , 05:15 PM






Try placing the IIF inside a CStr() function, because IIF returns an Object,
you usually need to convert it. Good Luck!
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"sam" <none (AT) none (DOT) fr> wrote

Quote:
Why using an IIF in a DataTable.Select(IIF("column1=zz",
"column2","column3")); is in invalid context ?
What is the way for using an IIF in a Datatable.Select(...) ?

Thanks for help.

sam






Reply With Quote
  #3  
Old   
sam
 
Posts: n/a

Default Re: Why DataTable.Select("IIF(...)") is refused ! - 08-19-2007 , 02:20 AM



"Nathan Sokalski" <njsokalski (AT) hotmail (DOT) com> a écrit dans le message de news:
O4dKtzd4HHA.5984 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
Quote:
Try placing the IIF inside a CStr() function, because IIF returns an
Object, you usually need to convert it. Good Luck!
I have drop the IIF in a Convert.ToString() but the compiler says:
DataTable.Select(Convert.ToString(IIF("name_real=" +null,"name_to_use",
"")));
"The name 'identifier' does not exist in the current context "
Someone knows how using IIF in a DaTaTable.Select() ?

Sam

"Nathan Sokalski" <njsokalski (AT) hotmail (DOT) com> a écrit dans le message de news:
O4dKtzd4HHA.5984 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
Quote:
Try placing the IIF inside a CStr() function, because IIF returns an
Object, you usually need to convert it. Good Luck!
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"sam" <none (AT) none (DOT) fr> wrote in message
news:%23tV%2315c4HHA.2108 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Why using an IIF in a DataTable.Select(IIF("column1=zz",
"column2","column3")); is in invalid context ?
What is the way for using an IIF in a Datatable.Select(...) ?

Thanks for help.

sam








Reply With Quote
  #4  
Old   
Sheng Jiang[MVP]
 
Posts: n/a

Default Re: Why DataTable.Select("IIF(...)") is refused ! - 08-20-2007 , 01:55 PM



DataTable uses a regular expression to parse your filter. It is likely that
they don't support some SQL functions.
Use a query to populate the data table with filtered results.

--
Sheng Jiang
Microsoft MVP in VC++
"sam" <none (AT) none (DOT) fr> wrote

Quote:
Why using an IIF in a DataTable.Select(IIF("column1=zz",
"column2","column3")); is in invalid context ?
What is the way for using an IIF in a Datatable.Select(...) ?

Thanks for help.

sam






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.