Wednesday, May 26, 2010

"Specified cast is not valid" when converting to variable from SqlDataReader

Problem:
"Specified cast is not valid." exception thrown from converting data from a SqlDataReader, i.e. short shortVar = (short)reader["shortField"];


Solution:
If your types are actually the same, then this error implies that you must use a Convert.To method.


Example:
buggy: 
short shortVar = (short)reader["shortField"];
fixed:
short shortVar = Convert.ToInt16(reader["shortField"]);

How to add resources to subprojects in Project Server 2010

If you have a master project with many subprojects then the answer is crappy. You must add the resources to each subproject individually. Unfortunately the resources do not appear to trickle down from the master project.

Friday, May 21, 2010

SharePoint People Picker Returns No Results

Problem:
In SharePoint Server 2010 in Central Admin you try to look up a user, but it returns no results.

Solution:

1. Open up SharePoint Management Shell
2. Run these two commands
  • stsadm -o setapppassword -password password 
  • stsadm -o setproperty -pn peoplepicker-searchadforests -pv "domain:domaintosearch.com,username,password" -url http://centraladminurl

References:

Jonny Trees Online: SharePoint People Picker Returns No Results

http://www.sharepointdevwiki.com/display/spadmin2010/15+-+Configure+User+Profile+Synchronization+Service
There was an error in this gadget