All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
Asp.Net,Ajax,学习笔记11,AJAX,Library中的面向对象类型系统_[Asp.Net教程]
ajax和asp.net的配置文件_.net资料_编程技术
asp.net代码实现上传图片并生成缩略图_[Asp.Net教程]
33条C#、.Net经典面试题目及答案_.net资料_编程技术
select控件在Mozilla和Opera中的问题_JavaScript技术_编程技术
C#文件处理技术:File和Directory
ASP.NET技巧:一些常用的数据操作类_[Asp.Net教程]
XML入门教程-向XML文件存储数据_[XML教程]
C++面向对象基本概念解析[二]
PHP动态网页程序中常用的表单验证类_[PHP教程]
Reading number is top 10 pictures
避免防盗门的猫眼变成钥匙眼
Compared GDP and per capita income in China for 40 years
小学生考试又现神作--还有外国的
The Soviet union swimsuit exposure in the 70 year1
非笑不可:最强爆笑图片精选
含苞欲放的素颜美少女3
Startling Russian girl blind date scene3
BingBingFan apple dew point photo gallery4
Ashlynn Brooke photograph of a group4
赵惟依写真2
Download software ranking
美女写真3
Boxer vs Yellow4
Boxer's Top ten classic battle5
Boxer Classic video1
Boxer's Top ten classic battle9
Tram sex maniac 2 (H) rar bag15
apache-tomcat-6.0.33
asp.netWeb服务器高级编程
Unix video tutorial12
虚拟机汉化软件
aaa published in(发表于) 2013/12/18 7:56:16 Edit(编辑)
ASP.NET如何保留两位小数点_.net资料_编程技术

ASP.NET如何保留两位小数点_.net资料_编程技术

ASP.NET如何保留两位小数点_.net资料_编程技术-你的首页-uuhomepage.com

问题:要在Datagrid中显示时间为2.08小时,我在SQL中这样处理:SELECT 125 / 60.00 AS float
但在Datagrid中显示为2.083333,请问如何写代码只保留两位小数点2.08?
______________________________________________________________________________________________
答1:
float(7,2)
2表示保留两位小数
______________________________________________________________________________________________
答2:
float(8,2)?在哪写呢?
______________________________________________________________________________________________
答3:
在datagrid的属性生成器中,列,数据格式设置表达式加上:
{0:f2}
______________________________________________________________________________________________
答4:
1.在sql语句中:select convert(dt,numeric(5,2)) from


2.在datagrid的绑定列的数据格式一栏添加:{0:f2}
______________________________________________________________________________________________
答5:
任选其一
______________________________________________________________________________________________
答6:
是这样写吗“select convert(125/60.00,numeric(5,2)) from ”?
这样写运行时出错啦...


______________________________________________________________________________________________
答7:
select round(125/60.00,2)
______________________________________________________________________________________________
答8:
select cast(125/60.00 as numeric(5,2))
______________________________________________________________________________________________
答9:
Thank you.
请问使用round和cast有何区别?
______________________________________________________________________________________________
答10:
把数据库中的相应字段设置为decimal,然后把他的小数位改成2
______________________________________________________________________________________________
答11:
在Datagrid的OnItemDataBound事件中写e.item.cell[0].text = float(7,2).Tostring()
就在dg中第0列中转换并显示出来了


______________________________________________________________________________________________
答12:
方法确定很多
1、设计字段时类型为numeric,小数位设置成2
2、在sql语句中转换:select convert(字段,numeric(18,2)) AS 字段Ex from 表
如果是datagrid绑定列,则


3、在datagrid的绑定列的属性中这样使用





添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.