04 2012 档案
摘要:代码:#region DataGridVeiw Style System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); this.DataGridView1.AllowUserToAddR
阅读全文
摘要:可写为string str=douRate.ToString("0.00");如返回为double型也可以double dou=double.Parse(douRate.ToString("0.00"));当然了也可以用 Math.Round方法decimal result = Math.Round(douRate,2); 后面的2表示保留小数点后2位小数
阅读全文
摘要:用dt.DefaultView.Sort = "RateSort desc"; 方法排序出来的顺序是1,10,2,20,3,30而非1,2,3,10,20,30解决方案:按数值排序,可以添加一列转换为数值后的列dtSum.Columns.Add("RateSort", typeof(int));将此列的值存放要排序的数值型例:dtSum.Columns.Add("Rate");//用于显示dtSum.Columns.Add("RateSort", typeof(int));//用于排序double douRate
阅读全文
摘要:在c#中除法默认不保留小数点,decimal result = 100 / 1000; // result = 0;需要保留小数点,可以如下decimal result = 100m / 1000;m代表decimal.如果是变量要如何处理呢?这是需要用到Math.Round()int x= 120;int y= 100000;decimal result = (decimal)x / y; // (decimal)x/ y 表示把 x 转换成decimal再做除法运算,int 除 int 是会丢失小数点的。不过这样的小数点后面的数太多了,需要处理下,这时候需要Math.Round()deci
阅读全文
摘要:分组求行数 SELECT DateTime,AgentName ,Count(SessionId)as DayWorkSum ,1 as DayWork FROM cti_record WHERE Date ='2012-03-04' and AgentName in (1006,1013 )gro
阅读全文
摘要:1、map简介map是一类关联式容器。它的特点是增加和删除节点对迭代器的影响很小,除了那个操作节点,对其他的节点都没有什么影响。对于迭代器来说,可以修改实值,而不能修改key。2、map的功能自动建立Key - value的对应。key 和 value可以是任意你需要的类型。 根据key值快速查找记录,查找的复杂度基本是Log(N),如果有1000个记录,最多查找10次,1,000,000个记录,最多查找20次。 快速插入Key - Value 记录。 快速删除记录 根据Key 修改value记录。 遍历所有记录。 3、使用map使用map得包含map类所在的头文件#include <m
阅读全文