Sharepoint学习笔记---Linq to Sharepoint--增,删,改操作
首先在我们的测试网站创建一个名为MyProducts的List,定义三个Customer Column均为String类型。如图
当然,你不用插入任何记录。
下面以此List为对象进行相应的增,删,改操作
1、添加操作
EntityList<MyProductsItem> MyCustProducts;
MyCustProducts = dc.GetList<MyProductsItem>("MyProducts");
string ProductNameStr = "NewProductName";
MyProductsItem newProduct = new MyProductsItem();
newProduct.Title = "ATestPrd" + DateTime.Now.ToShortTimeString().Trim();
newProduct.ProductName = ProductNameStr;
newProduct.ProductPrice = "15";
dc.MyProducts.InsertOnSubmit(newProduct);
dc.SubmitChanges();
2、修改操作
EntityList<MyProductsItem> MyCustProducts;
string ProductNameStr = "ModifiedProductName";
MyCustProducts = dc.GetList<MyProductsItem>("MyProducts");
var updateItem = (from p in MyCustProducts
where p.ProductName == ProductNameStr
select p).First();
updateItem.Title = "Updated" + ProductNameStr;
// Submit the changes
dc.SubmitChanges();
3、删除操作
EntityList<MyProductsItem> MyCustProducts;
MyCustProducts = dc.GetList<MyProductsItem>("MyProducts");
string ProductNameStr = this.txtBxProductName.Text.ToString();
// Querying the list item that has to be deleted
var delItem = (from p in MyCustProducts
where p.ProductName == ProductNameStr
select p).First();
// Deleting the list item
MyCustProducts.DeleteOnSubmit(delItem);
// Submit the changes
dc.SubmitChanges();
Sharepoint学习笔记---Linq to Sharepoint--增,删,改操作相关推荐
- Sharepoint学习笔记---Linq to Sharepoint--查询语法
Linq to sharepoint的引入的确给我们操作Sharepoint带来了便利,首先就体现在对Sharepoint 的查询优势上.它基本可以照搬Linq to SQL的查询语法,这就大大保护了 ...
- Sharepoint学习笔记 –架构系列—Sharepoint的客户端对象模型(Client Object Model)
前面过了一下Sharepoint的服务器端对象模型,接下来就让我们大致看看Sharepoint的客户端对象模型(Client Object Model: Client OM). 首先需要了解的就是Sh ...
- Sharepoint学习笔记---如何找到SharePoint List的Template ID
我们可以利用Visual Studio2010结合owssvr.dll来找到我们指定的Sharepoint List所使用的Template的ID值. OWSSVR.DLL实际上是一个在IIS中注 ...
- Sharepoint学习笔记—架构系列
为便于查阅,这里整理并列出了我的Sharepoint学习笔记中涉及架构方面的有关文章,有些内容可能会在以后更新. Sharepoin学习笔记-架构系列-- Sharepoint的网页(Page), ...
- Sharepoint学习笔记—ECMAScript对象模型系列-- 7、获取和修改List的Lookup字段
在前面我们提到了如何使用ECMAscript对象模型来操作普通的List Items,但如果我们操作的List包含有Lookup字段,那么我们又该怎么做呢? 首先参考此文搭建我们本文的测试环境 Sha ...
- mysql没法修改数据_MySQL学习笔记之数据的增、删、改实现方法
本文实例讲述了MySQL学习笔记之数据的增.删.改实现方法.分享给大家供大家参考,具体如下: 一.增加数据 插入代码格式: insert into 表明 [列名-] values (值-) creat ...
- Sharepoint学习笔记---Sandbox Solution-- Full Trust Proxy--开发实例之(2、在Webpart中访问Full Trust Proxy)...
上一篇Sharepoint学习笔记---Sandbox Solution-- Full Trust Proxy--开发实例之(1.创建一个能访问DataBase的Full Trust Proxy), ...
- Sharepoint学习笔记—Site Definition系列-- 2、创建Content Type
Sharepoint本身就是一个丰富的大容器,里面存储的所有信息我们可以称其为"内容(Content)",为了便于管理这些Conent,按照人类的正常逻辑就必然想到的是对此进行&q ...
- Sharepoint学习笔记---如何在Sharepoint2010网站中整合Crystal Report水晶报表(显示数据 二)...
在Sharepoint学习笔记---如何在Sharepoint2010网站中整合Crystal Report水晶报表(显示数据一)中,解释了如何把Crystal Report整合到Sharepoint ...
- Sharepoint学习笔记—Ribbon系列
为便于查阅,这里整理并列出了我的Sharepoint学习笔记中涉及Ribbon开发的关文章,有些内容可能会在以后更新. Sharepoint学习笔记-Ribbon系列-- 1. Ribbon的架构 ...
最新文章
- layui 下拉选择框可以选择但不显示数据值_你想做的quot;基因药物疾病quot;网络数据在这里!...
- ABI 与 API 的区别(应用程序二进制接口、应用程序编程接口)
- .net上传,一个选择直接上传(ashx)和byteArray上传
- 云栖大会 | 马云提出“新制造”战略将影响全球
- class触发后让另一个class加样式_Bootstrap的按钮组样式
- 量子计算机 真假,复原乳到底有没有营养?量子计算机是否已拍死“前浪”?“科学”流言榜告诉你真假...
- Opencv---remap函数的实现
- week one(1)—What is machine learning?
- phpcms如何做企业站-- 替换首页最初操作
- js字符串、数组处理方法、以及一些常用js方法
- bzoj1724[Usaco2006 Nov]Fence Repair 切割木板*
- inner join ,left join ,right join 以及java时间转换
- hashtable的C++实现
- 《普林斯顿微积分读本》笔记-第4章求解多项式的极限问题
- 普通进销存管理系统设计
- android vplayer 开源,万能视频播放器VPlayer评测:国内唯一真正硬解码
- 抑制剂拮抗剂等小分子化合物
- 时区提示:Local time zone must be set--see zic manual page 2018的解决办法
- vi命令下编辑文件时,按insert键文件底部无法编辑
- 人参果水果宣传文案模版,水果店文案人参果
热门文章
- ArcGIS 赋予不同指标权重计算综合结果
- CentOS7.3系统Tomcat无法正常启动解决(8005端口不能启动)
- Okhttp之RealConnection建立链接简单分析
- 制作单机俄罗斯方块游戏总结(一)
- 阿里巴巴Java 程序员常用的 10 款开源工具!用好了,事半功倍!
- 疫情之下,计算机仿真程序告诉你,没事别乱出门!企业复工务必做到八个“一”...
- 我用Python又爬虫了拉钩招聘,给你们看看2019市场行情
- python使用梯度下降方法实现线性回归算法_python实现线性回归梯度下降算法
- linux四种网络模式,Linux三种网络连接模式
- login.html id=9453,我关注的官网.html