SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to SharePoint and I'm working with web parts.

I have learned how to create a basic webpart and how to deploy it...but I don't have any ideas about how to create a web part that adds updates and deletes records from a database.

share|improve this question

Making a Web Part that adds, updates or deletes item from a database is just standard ASP.NET programming. For instance if you want to insert a record to a database then you probably would like to add a button to your Web Part that has a click-handler method in which you make the database operations.

share|improve this answer
Thanks for the reply, i create one web part and add db connection and try to bind DataGrid with Database table...but when i try to add the web part to my WSS i got error "Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." here is my code – Anonymous Apr 19 '10 at 7:03
This is due to the fact that you are running your Web Part under minimal trust/in the local bin of the web app (I guess). You need to add custom CAS policies. Read AC's CAS policy article on MSDN for more info: – Wictor Wilen MCA MCM MVP Apr 19 '10 at 8:02

You can use SPGridView instead of ASP.NET GridView, and consider SharePoint to be just another database repository.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.