07 2013 档案

摘要:数据库中不使用锁时可能出现的问题:1.更新丢失(Lost update) 两个事务都同时更新一行数据,但是第二个事务却中途失败退出,导致对数据的两个修改都失效了。这是因为系统没有执行任何的锁操作,因此并发事务并没有被隔离开来。2.脏读(dirty reads) 无效数据的读出,例如一个事务T1对一行数据进行了修改,但是还没有提交,另外一个事务T2读取该行,T1又因为某种原因撤销了对该行的修改,那么T2读取的数据就是无效的。一个事务开始读取了某行数据,但是另外一个事务已经更新了此数据但没有能够及时提交。这是相当危险的,因为很可能所有的操作都被回滚。3.不可重复读(Non-repeatable r 阅读全文
posted @ 2013-07-29 14:50 hongdada 阅读(557) 评论(0) 推荐(0) 编辑
摘要:1.自增列通用:select id=(select count(1) from table b where b.sid<a.sid) ,* from table a;select id=identity(int,1,1),* from ...第二个已经有主键自增列的就不可以用了还有就是rownumber2. CREATE TABLE dbo.#testTab ( Id int NOT NULL ) 添加数据: insert into #testTab values(3); insert into #testTab values(4); insert into #testTab valu. 阅读全文
posted @ 2013-07-25 10:59 hongdada 阅读(293) 评论(0) 推荐(0) 编辑
摘要:let: String[] strs = { "A penny saved is a penny earned.", "The early bird catches the worm.", "The pen is mightier than the sword." }; var result = from s in strs //s是数组strs中的一个元素 let word = s.Split(' ') //word是s句子中的单词数组 ... 阅读全文
posted @ 2013-07-04 15:54 hongdada 阅读(435) 评论(0) 推荐(0) 编辑
摘要:还是上一份的代码例子: public class Person { public int ID { get; set; } public string Name { get; set; } public int Age { get; set; } } public class Dog { public int ID { get; set; } public string Name { get; set; } public int PersonID { get; set; ... 阅读全文
posted @ 2013-07-03 18:06 hongdada 阅读(661) 评论(0) 推荐(0) 编辑
摘要:代码: public class Person { public int ID { get; set; } public string Name { get; set; } public int Age { get; set; } } public class Dog { public int ID { get; set; } public string Name { get; set; } public int PersonID { get; set; } }... 阅读全文
posted @ 2013-07-03 14:31 hongdada 阅读(603) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示