public int CountMoney()
{
if (!DBNull.Value.Equals(Eval("LawyerMoney")) && !DBNull.Value.Equals(Eval("OtherMoney")))
{
int money1 = Convert.ToInt32(Eval("LawyerMoney"));
int money2 = Convert.ToInt32(Eval("OtherMoney"));
return money1 + money2;
}
if (!DBNull.Value.Equals(Eval("LawyerMoney")) && DBNull.Value.Equals(Eval("OtherMoney")))
{
int money1 = Convert.ToInt32(Eval("LawyerMoney"));
return money1;
}
if (DBNull.Value.Equals(Eval("LawyerMoney")) && !DBNull.Value.Equals(Eval("OtherMoney")))
{
int money2 = Convert.ToInt32(Eval("OtherMoney"));
return money2;
}
else
{
return 0;
}
}

DBNull 与 求和方法的更多相关文章

  1. C#中关于DBNULL的处理方法

    从数据库中获取数据有些会是空值的,这时一不注意就会被坑了…… String.Concat(db.可能为DBNULL的值) 在这种情况下,如果是DBNULL,得到的会是""

  2. ORACLE逐行累计求和方法(OVER函数)

    1.RANK ( ) OVER ( [QUERY_PARTITION_CLAUSE] ORDER_BY_CLAUSE ) DENSE_RANK ( ) OVER ( [QUERY_PARTITION_ ...

  3. JS 数组求 最大值、最小值、平均值以及求和方法

    function arrMaxNum2(arr) { return Math.max.apply(null, arr); } function arrMinNum2(arr) { return Mat ...

  4. Java——写一个求和 “方法”

    在c语言中叫做函数 撸代码: import java.math.*; import java.util.Scanner; /*导入一个 math包 * BigDecimal 精确小数 * BigInt ...

  5. cxGrid的使用方法

    来源 http://www.cnblogs.com/djcsch2001/archive/2010/07/19/1780573.html   1.  去掉GroupBy栏 cxGrid1DBTable ...

  6. 集合类 Contains 方法 深入详解 与接口的实例

    .Net 相等性:集合类 Contains 方法 深入详解 http://www.cnblogs.com/ldp615/archive/2009/09/05/1560791.html 1.接口的概念及 ...

  7. .NET和SQL Server中“空值”辨析 (DBNull与Null的区别)

    对表进行插入操作,如datetime和int类型的两个字段,都允许为null,用“sqlcmd.Parameters.Add("@t12",tb12.Text)”参数绑定时.dat ...

  8. leetcode 题解 Add Two Numbers(两个单链表求和)

    题目: You are given two linked lists representing two non-negative numbers. The digits are stored in r ...

  9. DBNull.Value 字段的用法

    DBNull 是一个单独的类,这意味着该类只能存在此实例.它指数据库中数据为空(<NULL>)时,在.net中的值 如果数据库字段的数据缺失,则您可以使用 DBNull.Value 属性将 ...

随机推荐

  1. oracle的游标

    declare v_0 number; v_1 number; cursor c1 is select productordernumber from his_productorder@pro_crm ...

  2. ADURL简化程序

    using System; using System.Diagnostics; using System.Net; using System.Text; using System.Web; using ...

  3. poj1050

    To the Max Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 39081   Accepted: 20639 Desc ...

  4. CListBox多选情况处理方法

        如ListBox的内容如下,蓝色代表选中的内容 列表  索引  删除时索引  item1 0  0  item2 1  0  item3 2    item4 3  1 删除所有选中列: vo ...

  5. Sql Server中不常用的表运算符之PIVOT

    PIVOT是SQL Server2005新添加的一个表运算符,作用在于将行转为列. 先来看看他的基本语法: 来自http://technet.microsoft.com/zh-cn/library/m ...

  6. 删除win7远程桌面历史记录

    开始-运行-“regedit”注册表中找到HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default 删除不需要的即可

  7. Jquery / js 判断数据类型方法(限制文本框类型输入)

    当想要判断文本框中的值是否为自己想要的类型时,可以通过一些方法作出判断,这里对于光标离开文本框时判断文本框中输入的是否是数值类型,如果不是,做出提示 $("#WORKYEARS") ...

  8. js中原型继承的三种方式

  9. scala控制结构

    #判断 scala> def min(x:Int,y:Int):Int={ var a=x if(x>y) a=y return a } scala> min(1,2)res1: I ...

  10. StaticPagedList

    估计是因为水平原因,之前看别人写的用pagedList分页,老是云里雾里的.下面把自己写的整理一下放在上面.这里的List为对应页面展示的内容.不用查询所有. Action: public Actio ...