How can you set your ConnectionString on your Web part

Hi Folks,

This is a tricky post,alot of question i found on the web regarding how can i put the connection string for my web part once i finished my development and i want to be work with my sharepoint site. simply add your connection string on the web.config of your web site .

web.config of your site path :

simply add the connection string section after the sharepoint key and before system.web key as follows :


{add providername=”System.Data.SqlClient” connectionstring=”Data Source=server;Initial Catalog=mydb;User ID=DotNetBoom;Password=DotNetBoom” name=”MyConnect”}


please replace {} with .

Hope this helps………….

Mostafa arafa

Leave a Reply

Your email address will not be published. Required fields are marked *