Esempio n. 1
0
        public JsonResult ReturnJson()
        {
            string sql = "select AccountNumber,Name from [dbo].[SysUser]";

            DAL.SqlHelper sqlHelper = new DAL.SqlHelper();

            DataTable dataTable = sqlHelper.SqlConnectionInformation(sql);

            var list = (
                from d in dataTable.AsEnumerable()
                where d.Field <string>("Name") == "许嵩"
                select new User
            {
                Number = d.Field <string>("AccountNumber"),
                Name = d.Field <string>("Name")
            }
                ).ToList();

            return(Json(list, JsonRequestBehavior.AllowGet));
        }