.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

BCS - External Database and Add, Edit, Delete Operations

Posted By:Jean Paul       Posted Date: December 31, 2012    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we can experiment with BCS by connecting to an external database. After completing this article you will be able to View Database Table inside SharePoint and Perform Add, Edit, Delete operations
 


In this article we can experiment with BCS by connecting to an external database.  After completing this article you will be able to:

·  View Database Table inside SharePoint
·  Perform Add/Edit/Delete operations

Following are the activities involved.

1.  Create database and table
2.  Using SharePoint Designer create BCS External Content Type
3.  Using SharePoint Designer create Add/Edit/Delete operations metadata
4.  Using SharePoint Designer create Lists & Form
5.  Using Central Administration set Permissions for external Content Type
 
1.  Create database and table

Create a database and table named Customer with following fields:



Add some data into it:



2.  Using SharePoint Designer create BCS External Content Type


Now we can create an External Content type using SharePoint Designer.  Start the Designer application and open our SharePoint web site > External Content Types as shown below.



Click on the External Content Type button from the top side.  In the appearing window change the Name and Display Name (click on the links) as shown below.



Now click on the External System link and you will get the following dialog.



Click on the  Add Connection button and select SQL Server in the appearing dialog.



In the appearing connection details dialog, enter your server details.



Click the OK button and your server connection is ready. 

3.  Using SharePoint Designer create Add/Edit/Delete operations metadata


From the appearing tables list select the Customer table and right click to get the context menu.  Use the Create All Operations menu item to get the Add/Edit/Delete operations wizard.



Click on the Finish button in the appearing wizard.



Click on the Save button from the top tool bar.



4.  Using SharePoint Designer create Lists & Form


Now the operations are ready and we need to create the List Form and the associated Add/Edit/Delete forms inside SharePoint.



From the toolbar, click on the Create Lists & Form button as highlighted above.  In the appearing dialog box enter the name for the List and click the OK button as shown below.



Wait for a while and your List page will be ready.



5.  Using Central Administration set Permissions for external Content Type

Now you can try viewing the Customer Data list inside SharePoint. 



On clicking the list, you will be seeing an “Access Denied by Business Data Connectivity” error message.  To resolve this we need to set permission for the External Content Type.

Open the SharePoint Central Administration website.  Click on Manage Service Applications.



In the appearing page click on the Business Data Connectivity Services link as shown below:



In the appearing list, hover over the Customer Data item and click on the Set Permissions menu item as shown below.



You will get the following dialog.



Enter the user name, click the Add button and check all permissions.  Click the OK button to close the wizard.  (Make sure you are adding the username used to view SharePoint)

Now you are ready with the Permissions.  Go back to the SharePoint > Customer Data list and you will be able to see the data as shown below.



Now you can try playing with the View/Edit/Delete features of the BCS list.

References


http://www.zimmergren.net/technical/access-denied-by-business-data-connectivity-solution


Summary


In this article we have seen how to create an External Content Type through Business Connectivity Services and view it inside SharePoint.  In the real world scenario using BCS we can connect to WCF Services and other Business Applications like Microsoft CRM to view/update data inside SharePoint.

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend