Sue Hernandez's SharePoint Blog

SharePoint and Related Stuff

Monthly Archives: October 2012

SharePoint 2010 Crashes after Service Pack 1 SP1 and August 2012 Cumulative Update CU

Well we just applied Service Pack 1 (SP1) to our SharePoint 2010 server – both foundation and server – and then the August 2012 Cumulative Update (CU) server only (that’s what we were told to do by Microsoft – your situation may differ).

When we tried to browse to the root web after all of this was done (we had to run a few -force commands using command line PSConfig.exe after the GUI failed), and our site gave us a NASTY 500 error.

I tried to go to Inetmgr (Internet Information Services Manager) and tried to take a look at where the log files are kept, I couldn’t remember.  So it pops up with this message saying there’s something wrong with our web.config – specifically the system.web/pages node was duplicated.

So I took a backup of the web.config and looked, and indeed it had a duplicate entry.  Now here’s the wierd part, here was the dup:

 <pages enableSessionState="false" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">
        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
        <remove namespace="System.Web.UI.WebControls.WebParts" />
        <add tagType="System.Web.UI.WebControls.SqlDataSource, System.Web, Version=, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a" mappedTagType="Microsoft.SharePoint.WebControls.SPSqlDataSource, 
Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />

Be very careful that this is the one referencing the 12 version assembly – not the 14 version.  So I removed these lines and it now worked.

Stupid Mistake – stored procedure expects parameter which was not supplied

I made a boneheaded mistake today and wanted to write it down so I don’t make the same boneheaded mistake again.

I was writing a program for gathering some custom metrics in SharePoint, to be stored in a custom SQL table.   I had written a stored procedure and properly passed in all parameters, or so I thought.

SqlCommand cmd = new SqlCommand("NameOfMyStoredProcedure", mainConnectionObj);

cmd.Parameters.Add(new SqlParameter("@TimeStamp", startTime));
cmd.Parameters.Add(new SqlParameter("@WebURL", web.Url));
... [more parameters here]

I kept getting “Stored Procedure NameOfMyStoredProcedure expects parameter @TimeStamp which was not supplied”.  I double-checked and triple-checked to make sure I had the syntax right.  I then went down the route of thinking that TimeStamp was a reserved word.  But then I tried something – I reversed my first 2 parameters, and sure enough, it was complaining about @WebURL this time.

Turns out it was extremely simple.  I just needed to specify the CommandType, telling it that it was indeed a stored procedure.

SqlCommand cmd = new SqlCommand("NameOfMyStoredProcedure", mainConnectionObj);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@TimeStamp", startTime));
cmd.Parameters.Add(new SqlParameter("@WebURL", web.Url));

That was it. It then worked like a charm!