摘要: 1.ViewData:可存放任意类型数据,使用时需要转换,ViewData[“Info”]="hello",适合传递单个数据; 2.ViewBag:是对ViewData的封装,可读取ViewData保存的数据,反之亦然,ViewBag.stu=objStudent; 3.TempData:可跨视图, 阅读全文
posted @ 2016-02-16 22:41 待飞的亮 阅读(536) 评论(0) 推荐(0)
摘要: 1.视图引擎:把视图解析成浏览器可执行的html代码 2.aspx视图: <%=表达式%>: <% C#代码段 %>: 3.razor视图: @(表达式):@ViewData["name"],如果@后跟常量,必须用括号括起来:@(“hello”) @{C#代码段}:@{ if(a>b) { retu 阅读全文
posted @ 2016-02-16 21:29 待飞的亮 阅读(589) 评论(0) 推荐(0)
摘要: private static string connString=ConfigurationManager.ConnStrings["connString"].ToString(); //在app.config中configuration添加相应的数据库连接配置文件 1.格式化sql语句 //执行增 阅读全文
posted @ 2016-02-16 12:23 待飞的亮 阅读(605) 评论(6) 推荐(0)