03 2012 档案
如何实现数据在表内部置顶
摘要:先考虑按SortId降序排列的情况。初始状态SortId=Id方案1,首先获取当前最大的SortId,例如:@MaxSid = 100其次,将要置顶的行重新升序排列放入表变量里,并添加一列序号列select row_number() over(order by sortid) as NId,Id,SortId from T_Test where id in(11,22,33,44)order by sortid 结果:NIdIdSortId11111222223333344444然后,计算出新的SortId=@MaxSid+NIddeclare @t table(nid int,id int) 阅读全文
posted @ 2012-03-20 13:20 人在做,人在看 阅读(815) 评论(1) 推荐(0)
拼接字符串时的引号嵌套
摘要:IE8 有时候会发疯var name='abc';var a="My Name is '"+name+"',and home is 'AU' ";这样在字符串内出现两个单引号时 ie8有可能会报错 ,并且死都找不到为什么,只知道在某种环境下不能这样写,当出错后要么只剩下一个单引号,要么这样写var a = "My Name is \'"+name+"\',and home is 'AU' ";转义单引号 阅读全文
posted @ 2012-03-12 10:15 人在做,人在看 阅读(573) 评论(1) 推荐(0)
异步 进程 读取文件内容
摘要:class Class1 { public delegate int AsyncEventHandler(int a); static List<string> l = new List<string>(); static int ps = 1000; static long end = 0; static long start = 0; void Event1() { Console.WriteLine("Event1 Start"); Syst... 阅读全文
posted @ 2012-03-08 15:47 人在做,人在看 阅读(233) 评论(0) 推荐(0)
excel导入 总结
摘要:public static string GetConnectionString(string FileName) { if (FileName.ToLower().EndsWith("xls")) { return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + FileName + ";Extended Properties='Excel 8.0;HDR=No;IMEX=1;';Persist Security Info=False";... 阅读全文
posted @ 2012-03-07 17:48 人在做,人在看 阅读(962) 评论(1) 推荐(1)
json to dictionary
摘要:string str = "{\"fcode\":\"10\",\"fno\":\"009999\",\"fmemo\":\"009999-4\"}";Dictionary<string, object> dd = str.Trim(new char[] { '{', '}' }).Split(',') .ToDictionary(s => s.Split(':')[0].T 阅读全文
posted @ 2012-03-06 15:07 人在做,人在看 阅读(470) 评论(0) 推荐(0)
Sqlserver中tinyint, smallint, int, bigint的区别 及 10进制转换16进制的方法
摘要:一。类型比较bigint:从-2^63(-9223372036854775808)到2^63-1(9223372036854775807)的整型数据,存储大小为 8 个字节。一个字节就是8位,那么bigint就有64位int:从-2^31(-2,147,483,648)到2^31-1(2,147,483,647)的整型数据,存储大小为 4 个字节。int类型,最大可以存储32位的数据smallint:从-2^15(-32,768)到2^15-1(32,767)的整数数据,存储大小为 2 个字节。smallint就是有16位tinyint:从0到255的整数数据,存储大小为 1 字节。tinyi 阅读全文
posted @ 2012-03-06 11:36 人在做,人在看 阅读(25662) 评论(1) 推荐(6)