Sql中的numeric类型,对应的C#中的decimal类型

数据库中的numeric类型,,[SumMoney] [numeric](18, 2) ,标识总的18位,小数点后两位。

在C#中对应decimal类型。

ASP.NET中关于decimal的格式验证。

<asp:RegularExpressionValidator ID="revTotleMoney" runat="server" Display="Dynamic" ForeColor="Red" ControlToValidate="txtTotleMoney" SetFocusOnError="True" ValidationExpression="^(?!.{12,}$)\d{1,18}(\.\d{1,2})?$" ErrorMessage="输入不正确"></asp:RegularExpressionValidator>

计算
decimal totleMoney = decimal.Parse((double.Parse(txtACount.ToString().Trim()) * 78.21 * int.Parse(txtBCount.Text.ToString().Trim())).ToString());

posted @ 2013-10-24 09:55  源起  阅读(4379)  评论(0编辑  收藏  举报