Wednesday, January 30, 2008

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 :
D:\Inetpub\wwwroot\wss\VirtualDirectories\Port#\

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


{sharepoint}
..........
{/sharepoint}

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

{system.web}........

please replace {} with <> .

Hope this helps.............


Regards,
Mostafa arafa
Post a Comment