Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Handle Nulls In DataSet
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01383505
Message ID:
01383519
Views:
37
Thank you.



>If ISNULL(oRow["Payment'])
>
>
>
>>I have a a dataset with bank register data in it. I am adding a column, and I want to loop through the DS and compute the balance on the fly. I have:
>>
>>
>>
>>oRegisterDS = csRegister.oDataProcs.ExecuteQuery("b_GetRegisters", "Register", oRegParams);
>>
>>DataColumn oBalanceCol = new DataColumn("Balance", System.Type.GetType("System.Double"));
>>oRegisterDS.Tables["Register"].Columns.Add(oBalanceCol);
>>
>>double dBalance = 0;
>>foreach (DataRow oRow in oRegisterDS.Tables["Register"].Rows)
>>{
>>    if (oRow["Payment"] == null)
>>    {
>>        dBalance = dBalance + Convert.ToDouble(oRow["Deposit"]);
>>    }
>>    else
>>    {
>>        dBalance = dBalance - Convert.ToDouble(oRow["Payment"]);
>>    }
>>
>>    oRow["Balance"] = dBalance;
>>}
>>
>>
>>
>>The value of the Payment column on row 0 is null, yet it skips down into the ELSE section. What's the correct way to work with NULL in a DS?
>>
>>Thanks
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform