MSDN Archive Home
Help and FAQs
Data Access in a SharePoint Web Part
All Resource Updates
Change History (all pages)
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 - http://blog.tylerholmes.com/2008/03/walkthrough-creating-sharepoint-feature.html. 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.
Apr 2 2010 at 5:54 PM
, version 4
Nov 10 2010 at 9:05 AM
Can someone explain with the deployment instruction....Please???
May 29 2012 at 5:37 PM
Thank You! I was looking for simple examples and you helped me a lot!
Sign in to add a comment
Fri Apr 2 2010 at 7:00 AM
More Tags ...
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.