How to connect to SharePoint 2010 Foundation SQL database

1. Way one:


Insert the following string: \\.\pipe\mssql$sharepoint\sql\query and click “Connect”


2. Way two:

Create web application first

Go to Central Administration > Manage Content Database Settings > section: Database Information > Database server

Look at database information – something like “your computer name\your database name” – e.g. WIN-JEE3T28L2HC\WSS_Content


Insert the following string: WIN-JEE3T28L2HC\WSS_Content and click “Connect”

How to connect to SharePoint 2010 Foundation SQL database

SharePoint programming tips

#For blog

# Load site

string strUrl = “http://Server_Name/sites/Site_Name/Subsite_Name/default.aspx”;
using (SPSite oSiteCollection = new SPSite(strUrl))

SPSite oSiteCollection = new SPSite(“http://len-shareappt”);

SPSite oSiteCollection = SPContext.Current.Site;

# Load web

SPWeb oWebsite = oSiteCollection.RootWeb

SPWeb oWebsite = oSiteCollection.OpenWeb(“MyWebSite/MySubSite”)

# Load list

SPList oList = oWebsite.Lists[“Заявки”];

SPList oList = oWebsite.Lists.TryGetList(“Заявки”);

string listUrl = “/sites/sitecollection/subsite/Lists/Announcements”;
SPList list = web.GetList(listUrl);

# Load view

SPView oView = oList.Views[“All Items”];

SPView oView = oWebsite.GetViewFromUrl(“/Lists/Requests/atp_ks_uzr_bezdog.aspx”);

# Add field to view

string strNewFieldName = collviewFields.Add(“MyNewField”, SPFieldType.Text, false);
SPField oField = collviewFields.GetField(strNewFieldName);

SharePoint programming tips