Thursday, August 25, 2011

Using ADO.NET Data Services











using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Linq;
using System.Net;

namespace ProjectManagers
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        MyDataService.MeetingMangementDataContext ctx = new MyDataService.MeetingMangementDataContext(new Uri("http://crm-server:6861/_vti_bin/ListData.svc"));

        private void Form1_Load(object sender, EventArgs e)
        {
            ctx.Credentials = CredentialCache.DefaultCredentials;
            var q = from a in ctx.Announcements select a;
            this.announcementsItemBindingSource.DataSource = q;
        }

        private void announcementsItemBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            ctx.SaveChanges();
        }

        private void announcementsItemBindingSource_CurrentChanged(object sender, EventArgs e)
        {
            ctx.UpdateObject(this.announcementsItemBindingSource.Current);
        }

    }
}

No comments:

Post a Comment

Featured Post

Protect an API by using OAuth 2.0 with Azure Active Directory and API Management

Protect an API by using OAuth 2.0 with Azure Active Directory and API Management https://docs.microsoft.com/en-us/azure/api-management/api-...

Popular posts