user1186850
user1186850

Reputation: 133

How to use like expression of datatable

I want to add new column 'temp' into datatable with following below

datatable.Columns.Add(
    'temp', typeof(string), 
    "Convert(IFF(" + column + 
    " like '%#' == True ,'isTrue','isFalse'), 'System.String')");

but I get an error: "The expression contains undefined function call IFF()."

Upvotes: 0

Views: 919

Answers (1)

Jay Riggs
Jay Riggs

Reputation: 53593

Simple typo: IFF should be IIF.

I also think there's something wrong with your conditional expression in your IIF statement. Try this instead:

datatable.Columns.Add("temp", typeof(string), 
                     "Convert(IIF(" + column + " like '%#','isTrue','isFalse'), 'System.String')");

Upvotes: 8

Related Questions