Re: DataColumn.Expression error handling
From: Miha Markic [MVP C#] (miha)
Date: 07/01/04
- Next message: agassi: "help with SQL queries"
- Previous message: pali: "DataColumn.Expression error handling"
- In reply to: pali: "DataColumn.Expression error handling"
- Next in thread: pali: "Re: DataColumn.Expression error handling"
- Reply: pali: "Re: DataColumn.Expression error handling"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 1 Jul 2004 13:45:44 +0200
Hi pali,
This is vb behaviour where IIF is a procedure that you pass parameters to.
It is not the same as ?: operator in C# I believe.
Thus you might modify it a bit just to avoid an exception:
IIF(budget_ext_price = 0, 'NaN', material_margin / iif(budget_ext_price=0,
1, budget_ext_price))"
Didn't test it but it might work :-)
-- Miha Markic [MVP C#] - RightHand .NET consulting & development miha at rthand com www.rthand.com "pali" <pali@discussions.microsoft.com> wrote in message news:607B25D3-2DC9-42F5-AF61-C3AA54EED884@microsoft.com... > Hi, > I need to compute a percentage in a DataTable, so i'm trying to use the Expression property provided by the DataColumn object. My problem is the classic division by zero error. > This is my expression: > "IIF(budget_ext_price = 0, 'NaN', material_margin / budget_ext_price)" > Now, it seems that the material_margin / budget_ext_price expression is being evaluated regardless of the condition. If i replace the '/' with '-', I get correctly NaN in one row, though with '/' I get division by zero exception. Is the false part really being evaluated, even in the case the condition is true?
- Next message: agassi: "help with SQL queries"
- Previous message: pali: "DataColumn.Expression error handling"
- In reply to: pali: "DataColumn.Expression error handling"
- Next in thread: pali: "Re: DataColumn.Expression error handling"
- Reply: pali: "Re: DataColumn.Expression error handling"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|