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.


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.

  • 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: msdn.microsoft.com/en-us/library/ee909485.aspx – 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy