09 2015 档案
摘要:1.引入以下js和css 2. html代码如下 3.后台代码如下: public ActionResult News() { var list = db.Artists.Select(m => new { value=m.Name}).ToLi...
阅读全文
摘要:1.引用如下js和css 代码 2.验证代码 3. html代码@using(Html.BeginForm("form")){ @Html.TextBoxFor(m => m.titlenew); @Html.ValidationMes...
阅读全文
摘要:测试实体类 public class Test { public int id{get;set;} [Required(ErrorMessage="不能为空喔")] [StringLength(10,ErrorMessage="字符串不能超过10")]...
阅读全文
摘要:有时我们需要从DataTable中抽取Distinct数据,以前总是以对DataTable进行foreach之类纯手工方式获取。近来发现DataView可以帮我们直接获取Distinct数据,汗一个!DataTable dataTable;DataView dataView = dataTable....
阅读全文
摘要:[Key] //主键 [DatabaseGenerated(DatabaseGeneratedOption.Identity)] //设置自增 public int id { get; set; } [ForeignKey("catego...
阅读全文
摘要:SELECT INTO 和 INSERT INTO SELECT 两种表复制语句 Insert是T-sql中常用语句,Insert INTO table(field1,field2,...) values(value1,value2,...)这种形式的在应用程序开发中必不可少。但我们在开发、测试过...
阅读全文
摘要:ef join 用法var customers = DB.Customer.Join(DB.Commission,cst => cst.CommissionId,com => com.CommissionId, (cst, com) => new Customer(){CommissionId = ...
阅读全文
摘要:1、左连接:var LeftJoin = from emp in ListOfEmployeesjoin dept in ListOfDepartmenton emp.DeptID equals dept.ID into JoinedEmpDeptfrom dept in JoinedEmpDept...
阅读全文
摘要:1.在global.asax void Application_Start(object sender, EventArgs e) { // 在应用程序启动时运行的代码 // RouteConfig.RegisterRoutes(RouteT...
阅读全文
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Tran...
阅读全文
摘要:在一个MIS系统中,没有用事务那就绝对是有问题的,要么就只有一种情况:你的系统实在是太小了,业务业务逻辑有只要一步执行就可以完成了。因此掌握事务 处理的方法是很重要,进我的归类在.net中大致有以下4种事务处理的方法。大家可以参考一下,根据实际选择适当的事务处理。1 SQL事务 sql事务是使用SQ...
阅读全文
摘要:BEGIN TRAN Tran_Money --开始事务DECLARE @tran_error int;SET @tran_error = 0; BEGIN TRY UPDATE tb_Money SET MyMoney = MyMoney - 30 WHERE Name...
阅读全文
摘要:select b,c,CASE a WHEN '1' THEN '1001' WHEN '2' THEN '1002'ELSE '1003' end from test1
阅读全文
摘要:if exists(select * from test.dbo.test1 where a='1')beginprint('exists ')endelse begin print('no exists ') endgo
阅读全文
摘要:IF ELSE 语句 IF ELSE 是最基本的编程语句结构之一几乎每一种编程语言都支持这种结构而 它在用于对从数据库返回的数据进行检查是非常有用的TRANSACT-SQL 使用IF ELSE 的例子如下 语法 if (condition) begin (statement block) end e...
阅读全文
摘要:EF分页代码using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public part...
阅读全文
摘要:1.首先加入以下代码 View Code2.json.ashx代码如下using System;using System.Web;using System.Linq;using System.C...
阅读全文