Sunday, July 20, 2008

Generating user instances in SQL Server is disabled. Use sp_configure 'user instances enabled' to generate user instances.

Recently I noticed that many of my ASP.NET applications that work with a SQL Server Express database that resides in the App_Data directory stopped working. The culprit error was "Generating user instances in SQL Server is disabled. Use sp_configure 'user instances enabled' to generate user instances.". I suspect that a SQL Server update went out that disables user instances. I have not been able to substantiate this suspicion yet.


SOLUTION:

The solution is to enable user instances with the following command:

sp_configure 'user instances enabled','1';

Disable user instances with the following command:

sp_configure 'user instances enabled','0';

Friday, July 18, 2008

How to change the connection string name in a .NET 3.5 LINQ to SQL class?

Here's the scenario:


You developed an application that uses "LINQ to SQL" with a connection string name (say aa-db). In production you want the name to be different (say bb-db). What do you need to do to change the connection string name?

1) Open the *.dbml file in a text editor.

2) Change the "SettingsPropertyName=" property to the new name

3) Open the "*.designer.cs" file that is associated with the LINQ class and change the value of global::System.Configuration.ConfigurationManager.ConnectionStrings[...].

How to edit group on the SharePoint quicklaunch in WSS 3.0 (and MOSS 2007)?

It is always a good idea to lock down SharePoint sites such that users do not see more information than they need to. At the organization where I work, we have a plethora of SharePoint groups. With any new website that gets created, a user with full rights gets to see a list of all the groups by going to "Site Actions / Site Settings / Advanced Permissions". There is always the danger that a user can inadvertently delete or add a user to the wrong group. One simple solution is to remove unneeded groups from the quicklaunch. Here's what you can do:
  • Click on Site Actions / Site Settings / Advanced Permissions
  • Click on any group on the quicklaunch under "Groups"
  • Click on Settings / Edit Group Quick Launch
  • On the "Edit Group Quick Launch" page, highlight any group and hit the delete key on your keyboard

 

Wednesday, July 2, 2008

What is an easy way to find out the internal name of a SharePoint 2007 list column?

The internal name of a SharePoint list column can be different from the display name. This could happen if a column name has been renamed to something else. For example, if you rename the "Title" column to, say, "Company Name", the internal name remains as "Title". Also, spaces in the display name are replaced with "_x0020_" in the internal name. The internal name of "Contract_x0020_Type" would be used for display name "Contract Type".


An easy way to discover the internal name without any programming is:

- add the column to a view
- click on the column name to sort the view by that column
- check the URL for the "SortField=" parameter value.

I did this for a column name "Company Name" and got a URL similar to this:

http://www.domain.com/records/Documents/Forms/AllItems.aspx?SortField=Company%5fx0020%5fName&SortDir=Asc&View=%7b0E0FDBDA%2d1BA5%2d4CE1%2dBEE4%2d191B285E1F8A%7d

The above URL suggests that the internal field for "Compnay Name" is "Company_x0020_Name".

Note that the URL encoding for the underscore is "%5f".

Sunday, June 15, 2008

.netBC celebrates 5'th birthday and 1500'th member

The .netBC user group celebrated it's 5'th birthday on March 3, 2008. Soon after the group had it's 1500'th member when Hai Wang joined on April 5, 2008.


The Vice President of .netBC, Brian Pidcock, baked a pie for Hai Wang and presented it to him at our regular meeting on Tuesday May 6, 2008. Here is a picture of both Hai Wai and Brian Pidcock taken by a mobile phone:


Unfortunately, our speaker Dana Epp did not show up at that meeting held at BCIT in Burnaby, BC. When I contacted him the next day he said that he forgot about it. In the five years of the existance of our user group we never experienced a no-show by a speaker. I would like to apologize to those who attended for this unfortunate situation. John Bristowe of Microsoft Canada is sending me consolation gifts for those who came to this no-show meeting. These gifts will be delivered during our July 9, 2008 XNA event.

Tuesday, May 20, 2008

How to upgrade SharePoint 2007 web.config file from .NET Framework 3.0 to .NET Framework 3.5 support?

In order to take advantage of some of the great features of .NET Framework 3.5 in your SharePoint 2007, you will need to upgrade the web.config file. Some new features are LINQ, AJAX, and new controls like ListView. Here's a step-by-step task list of what needs to be added. Before we go on, make sure that you have installed the .NET Framework version 3.5 on the server. Also, make a backup copy of your SharePoint 2007 web.config file.
1) Add the following inside of the <configSections> tag block:

<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>

<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

</sectionGroup>

</sectionGroup>

</sectionGroup>

2) Add the following inside of the <httpHandlers> tag block:

<remove verb="*" path="*.asmx" />

<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

3) Add the following inside of the <httpModules> tag block:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

4) Add the following inside of the <assemblies> tag block:

<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

5) Add the following inside of the <pages> tag block:

<controls>

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</controls>

6) Add the following right before </configuration>:

<system.codedom>

<compilers>

<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">

<providerOption name="CompilerVersion" value="v3.5" />

<providerOption name="WarnAsError" value="false" />

</compiler>

<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">

<providerOption name="CompilerVersion" value="v3.5" />

<providerOption name="OptionInfer" value="true" />

<providerOption name="WarnAsError" value="false" />

</compiler>

</compilers>

</system.codedom>

<system.webServer>

<validation validateIntegratedModeConfiguration="false" />

<modules>

<remove name="ScriptModule" />

<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

</modules>

<handlers>

<remove name="WebServiceHandlerFactory-Integrated" />

<remove name="ScriptHandlerFactory" />

<remove name="ScriptHandlerFactoryAppServices" />

<remove name="ScriptResource" />

<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

<add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

</handlers>

</system.webServer>

Wednesday, April 30, 2008

How to get the whole announcement to show up in SharePoint 2007?

  1. Go into the Announcements section by clicking on the title.
  2. Create a new view based on the existing default. I called mine "All items with Body"
  3. Make sure the 'body' column is checked, and select "Newsletter" under Style.
  4. Go back to your main page, and select 'edit shared web part' for the announcements section you're working on.
  5. Change the view to be the new view you just created and click OK.