12 2013 档案

摘要:今天做东西时发现一个新东西。即在一个Action调用另一Action。前提是同一个控制器。(没在一个控制里的没试过)调用方法:public ActionResult Test1(){ //to do //这里做一些初始化 Test2(); Return View();(这里执行完Test2()后,还可以做其他操作,ex:Return Redirect("你想跳到的url");)}public ActionResult Test2(){ //to do return View();}有时候,我们会碰到相同的需求,但又有那么一点不一样。如果写在一个Action()里就会显得臃肿 阅读全文
posted @ 2013-12-31 18:26 paulhe 阅读(1121) 评论(0) 推荐(0)
摘要:TimeSpan timespan; //第一次获取系统时间 DateTime d1 = DateTime.Now; while (true) { //第二次获取系统时间 DateTime d2 = DateTime.Now; //求时间隔 timespan = d2 - d1;因为时间很难做到完全一样,所以因大于或等于(因使... 阅读全文
posted @ 2013-12-23 18:13 paulhe 阅读(1187) 评论(0) 推荐(0)
摘要:学的东西不做不练习就会忘掉。需求:用户本身的信息在数据库A,用户公司的信息在数据库B.查询这个用户的全部信息。举例图示说明:数据库A,用户信息表UserInfoIDNameSex1BobMale数据库B,用户公司表ComanyInfoIDCompanyNameUserId1Bob1sql:select * from [A].[dbo].[UserInfo] T1 inner join [B].[dbo].[ComanyInfo] T2 on T1.ID = T2.ID 阅读全文
posted @ 2013-12-20 19:54 paulhe 阅读(418) 评论(0) 推荐(0)
摘要:解决方案:1.将要比较的两个时间转成DateTime类型;DateTime date1 = DateTime.Parse("8:00");DateTime date2 = DateTime.Parse("18:00");2.使用DateTime.Compare()函数比较;if(DateTime.Compare(date1, date2)>0){ //to do;} 阅读全文
posted @ 2013-12-13 20:06 paulhe 阅读(397) 评论(0) 推荐(0)

friendster counter