Search Wiki:
Resource Page Description

A SharePoint Web Part that accesses data in a SQL Server database. This Web Part was created by using SharePoint Tools in Visual Studio 2010. This Web Part contains three GridView controls. Each control accesses the data by using a different approach.

• GridView 1 binds to data by using XML.
• GridView 2 binds to data by using Linq to SQL code.
• GridView 3 binds to data by querying the Business Data Catalog model.

The connection string is retrieved from the web.config file of the root site. The connection string is stored to that file by using code in a feature receiver. The code for adding and removing connection strings was taken from the following blog post - I modified that code only slightly.

To run this sample, you you must have the following software installed:

• Visual Studio 2010.
• SharePoint Server 2010.
• SQL Server.
• AdventureWorksLT2008R2 sample database.

You must also modify the feature receiver code to use your connection string. The name of that file is "Feature1.EventReceiver.cs".

Alternatively, you can open the project and examine the project for what you need. Then, you can create a new Visual Web Part project in Visual Studio and use what you want from this sample. That might be easier than trying get the sample and all of it's custom configurations to behave for you.
Last edited Apr 2 2010 at 5:54 PM  by normesta, version 4
NanmaAnn wrote  Nov 10 2010 at 9:05 AM  
Can someone explain with the deployment instruction....Please???

Jinx wrote  May 29 2012 at 5:37 PM  
Thank You! I was looking for simple examples and you helped me a lot!

Page view tracker