Microsoft Technology, .Net, BizTalk, Sharepoint & etc.

Liedong(Ken) Zheng, Senior SharePoint Developer at SIMPLOT

Archive for March, 2008

Use AjaxToolKit in vs 2008

Posted by ken zheng on March 31, 2008

Add AjaxControlToolkit and AjaxExtensionsToolbox to the references,

Modify your web.config file

<controls>
        <add tagPrefix=”ajaxToolkit” assembly=”AjaxControlToolkit” namespace=”AjaxControlToolkit”/>
    <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>

Add

<asp:ScriptManager ID=”scriptManager” runat=”server” EnablePartialRendering=”true” EnablePageMethods=”true”>
    </asp:ScriptManager>

under your FORM tag

Posted in VS2008 | Leave a Comment »

Generate GUID from IDE

Posted by ken zheng on March 29, 2008

To run guidgen.exe from the IDE

  1. On the Tools menu, click Create GUID. The Create GUID tool appears with a GUID in the Result box.
  2. Select the format you want for the GUID.
  3. Click Copy.

    The GUID is copied to the Clipboard so that you can paste it into your source code.

  4. If you want to generate another GUID, click New GUID.

Posted in .Net | Leave a Comment »

Show Code snipper manager

Posted by ken zheng on March 29, 2008

Code Snippet Manager Missing By default the Code Snippet Manager in Visual Studio 2005 should appear directly under the Tools menu. This is the second install I have noticed that it wasn’t there. Not sure what the combination is that is keeping it from being there by default, but if this happens to you restoring it is simple. Go to Tools -> Customize Select the Commands tab Select Tools Drag the Code Snippets Manager.. from Command up to the Tools menu.

Posted in .Net | Leave a Comment »

LINQ Tutorial

Posted by ken zheng on March 28, 2008

Posted in LINQ | Leave a Comment »

Can’t open published InfoPath forms

Posted by ken zheng on March 26, 2008

assigned to modify an InfoPath form (used in some Windows Workflow 3.0 development) which was built by another developer whom we are no longer in contact with. I kept trying to open the form but kept getting an error which said:

“This form cannot be opened because it requires the domain permission level and it currently has restricted permission. Contact the form author to resolve the issue.”

And another message which read:

“Forms that require the domain permission level contain features that access information on a network, such as data connections, linked images, and code.”

What you need to do is – Right click on the file and select ‘Design’.

Posted in Sharepoint | 3 Comments »

Very useful sharepoint tools

Posted by ken zheng on March 22, 2008

Posted in Sharepoint | Leave a Comment »

How to debug an eventhandler in sharepoint 2007

Posted by ken zheng on March 22, 2008

  1. put the evt hndlr in the bin folder in the IIS virtual folder that hosts your sharepoint application
  2. in visual studio (with the project open) click “debug” -> “Processes” and select the “w3wp.exe” process (may be more than one – select them all) and hit ok. when asked, select the “managedd code” option only (not script and sql)

Posted in Sharepoint | Leave a Comment »

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Shared Memory Provider, error: 40 – Could not open a connection to SQL Server) (.Net SqlClient Data Provider)

Posted by ken zheng on March 21, 2008

When connecting to an instance of Microsoft SQL Server 2005 database, including SQL Server 2005 Express, Developer and Enterprise editions, for authentication or accessing and retrieving and updating the data, the the following error message may appear. The problem happens no matter the connection is originated from remote computer or on SQL Server local computer itself, and can be caused by any program, such as SQLCMD utility, used to connect to SQL Server.

Sqlcmd: Error: Microsoft SQL Native Client: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

Or,

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2)

This problem may occur when SQL Server 2005 is not configured to accept incoming local and remote connections, which is disabled by default in SQL Server 2005 Express Edition, SQL Server 2005 Developer Edition and also SQL Server 2005 Enterprise Edition. To solve the connection forbidden problem, SQL Server 2005 needs to configure to allow incoming local and remote connections.

Firstly, ensure that SQL Server 2005 is configured properly to allow incoming connections on the instance of database server, else enable and turn on the local and remote connections setting.

Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005, followed by Configuration Tools. Click and run the SQL Server Surface Area Configuration.
On the “SQL Server 2005 Surface Area Configuration” page, click Surface Area Configuration for Services and Connections.
On the “Surface Area Configuration for Services and Connections” page, expand Database Engine tree, click Remote Connections.
Select Local and remote connections, or Local connections only which applicable only if there is no remote system tries to connect to the SQL Server, useful when you just trying to connect and authenticate with the server after installing.
Select the appropriate protocol to enable to local and/or remote connections environment. To ensure maximum compatibility, select Using both TCP/IP and named pipes.
Click Apply button when done.
Click OK button when prompted with the message saying that “Changes to Connection Settings will not take effect until you restart the Database Engine service.”
On the “Surface Area Configuration for Services and Connections” page, expand Database Engine, then click Service.
Click Stop button to stop the SQL Server service.
Wait until the MSSQLSERVER service stops, and then click Start button to restart the MSSQLSERVER service.
Secondly, SQL Server Browser service has to be enabled to allow for local and remote connections if SQL Server 2005 is running by using an instance name and users are not using a specific TCP/IP port number in the connection string.

Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005, followed by Configuration Tools. Click and run the SQL Server Surface Area Configuration.
On the “SQL Server 2005 Surface Area Configuration” page, click Surface Area Configuration for Services and Connections.
On the “Surface Area Configuration for Services and Connections” page, click SQL Server Browser.
Select Automatic as the Startup type to start SQL Server Browser service automatically every time system starts.
Click Apply button.
Click on Start button to start the service immediately.
Click OK button.
Finally, if remote computer needs to connect and access SQL Server, an exceptions in Windows Firewall included in Windows XP SP2 (Service Pack 2), Windows Server 2003 and Windows Vista needs to be created. If you’re using third-party firewall system, the exception rules also needed to be created to allow external remote connections to the SQL Server 2005 and SQL Server Browser Service to communicate through the firewall, else connections will be blocked. Consult the firewall manual for more details. Each instance of SQL Server 2005 must have its own exception, together with an exclusion for SQL Server Browser service.

SQL Server 2005 uses an instance ID as part of the path when you install its program files. To create an exception for each instance of SQL Server, you must identify the correct instance ID. To obtain an instance ID, follow these steps:

Click Start button, then go to Programs or All Programs, then select Microsoft SQL Server 2005, followed by Configuration Tools. Click and run the SQL Server Configuration Manager.
In “SQL Server Configuration Manager”, click the SQL Server Browser service in the right pane, right-click the instance name in the main window, and then click Properties.
On the “SQL Server Browser Properties” page, click the Advanced tab, locate the instance ID in the property list.
Click OK button.
Then create an exception for SQL Server 2005 in Windows Firewall.

Click on Start button, the click on Run and type firewall.cpl, and then click OK. For Windows Vista, type firewall.cpl in Start Search box and press Enter key, then click on Allow a program through Windows Firewall link on left tasks pane.
In “Windows Firewall”, click the Exceptions tab, and then click Add Program.
In the “Add a Program” window, click Browse button.
Click the C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe executable program, click Open button. MSSQL.1 with is a placeholder for the instance ID that is obtained from previous procedure. Note that the path may be different depending on where SQL Server 2005 is installed.
Click OK button.
Repeat steps 1 through 5 for each instance of SQL Server 2005 that needs an exception.
For SQL Server Browser service, locate the C:\Program Files\Microsoft SQL Server\90\Shared\sqlbrowser.exe executable program, and click Open button.
Click OK button.

Posted in SQL | 44 Comments »

Install 2005 SQL Server Management Studio

Posted by ken zheng on March 19, 2008

Go to the ‘Tools’ folder on the CD and run setup from there

Posted in SQL | Leave a Comment »

Automaticly add managed properties when new column being add

Posted by ken zheng on March 15, 2008

In SharePoint Central Administration click on the link below “Shared Services Administration”. Go to “Search Settings”, “Metadata property mappings”, “Crawled Properties”,”SharePoint”,”Edit Category”.Under the “Bulk Crawled Property Settings” section make sure the “Automatically discover new properties when crawl takes place” is checked along with the “Map all string properties in this category to the Content managed property” and the “Automatically generate a new managed property for each crawled property discovered in this category” options. Making sure these options are on ensures that managed properties are automatically created when new SharePoint columns are created. Your solution can use these new managed properties to present to the user. Unfortunately, the name of the managed property is not that user friendly. SharePoint crawled properties are prefixed with an “ows_” and the auto generated managed property is prefixed with “ows”. For example, if a user creates a new column in a document library called “CustomerName” then the crawled property will be “ows_CustomerName” and the managed property will be “owsCustomerName”. If you don’t want to display this to your users then you will have to write some code to parse out the real column name and make sure you map it back to the managed property name when constructing your query. Additional parsing may be needed if the column name has spaces in it. For instance if a user creates a column named “Customer Name” then the crawled property will be “ows_Customer_x0020_Name” and the managed property will be “owsCustomerx0020Name”.

Posted in Sharepoint | Leave a Comment »