Cannot Resolve Collation Conflict for Column n in SELECT Statement

When creating a stored procedure and it contains a SELECT statement, you may get the following error message even if the collation of your database seems to be correct.

Cannot resolve collation conflict for column n in SELECT statement.

where n is the column number.

This can be easily fixed by appending the following portion of SQL to the column n in your SELECT statement:

COLLATE <your database collation name>

For example, COLLATE SQL_Latin1_General_CP1_CI_AS.

The database could not be exclusively locked to perform the operation

When trying to change the collation of a database, you may get the following error message:

The database could not be exclusively locked to perform the operation.

To workaround this problem, we first need to set the database for single user.  And change it back for multi user after changing the collation.

ALTER DATABASE <database_name> SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE <database_name> COLLATE <target_collation_name e.g. SQL_Latin1_General_CP1_CI_AS>
ALTER DATABASE <database_name> SET MULTI_USER

Access to the Path… is denied

When your ASP.NET application tries to access a file in a folder, you may get an error message saying "Access to the path <file path> is denied.".  To solve this problem, you will need to provide permissions for NETWORK SERVICE (Windows 2003/2008) or ASPNET (Windows XP) account to access the folder containing that file.  To provide the permissions, do the following:

  1. Right click on the folder and select Properties.
  2. Go to Security tab (if it doesn’t appear, see below) and click on the Edit… button under Group or user names section.
  3. Click on the Add… button and, on the popup window (titled Select Users or Groups), click on the Advanced… button.
  4. Click on the Find Now button.
  5. Select NETWORK SERVICE (or ASPNET) account and click OK twice to go back to the permissions window.
  6. On the Permissions window, select the account and check Allow for Full Control.
  7. Click OK twice to close the Properties window.

Now your ASP.NET should have an access to the folder.

What if the Security tab doesn’t show up?

You’ll need to uncheck the Simple File Sharing option in folder options.

  1. On the Tools menu of your windows explorer, select Folder Options.
  2. On the View tab, scroll down until you find the option saying "Use Simple File Sharing (recommended)".
  3. Uncheck it and click OK to accept the change.

Now the security tab should appear and you can start configuring the permissions as stated above.

Two Great Firefox Extensions for RSS and Google Bookmark

The first extension I would like to recommend is RSS Ticker.  As you may have already known, Firefox can act as an RSS feed reader and you can just bookmark a feed as if it were a Web page.  RSS Ticker displays and scrolls a list of those feeds right under your menu bar.  Go ahead and give it a try.

stolenbit_view_feed_xml

 stolenbit_rss_subscribe

stolenbit_display_in_ticker

That’s it.  When there is a new post, you’ll get notified right on your Firefox Hot

Another extension that I’ve found to be very very useful is Google Bookmark IncSearch.  As you browse across the Web and find some useful pages that you want to keep, one way is to bookmark it on Google Bookmark so that you can access your bookmarks from anywhere.  However, sooner or later, you will find yourself store TOO MANY bookmarks and just you don’t seem to find what you want within your own bookmarks – even though you’ve well organized them.  And you probably end up with googling for what you want again -*-  Well, it would be nice if you can just search within your bookmarks if you know it IS there, wouldn’t it?  Google Bookmark IncSearch can help.  OK.  That’s enough for saying.  Give it a try and I’m sure you’ll love it just as I do Happy

 stolenbit_google_bookmark_incsearch

Enable Remote Connection on SQL Server 2008

By default, Microsoft SQL Server 2008 doesn’t allow any remote connection.  What we’ll need to do is to enable TCP/IP protocol in SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for <InstanceName> and enable the TCP/IP protocol as shown in the picture below.  An example of InstanceName is MSSQLSERVER.

stolenbit_enable_remote_connection_on sql_server_2008

After restarting SQL Server (InstanceName) service (as shown below), it should work without any problem.  You can quickly access the services windows by going to start menu > run > type services.msc.  Locate the SQL Server (InstanceName) service, right click on it, and choose restart.

stolenbit_sql_server_service

In my case, completing these steps enables me to connect from a remote machine successfully.  However, someone reported that we also need SQL Server Browser service running too.  Therefore, if completing the steps above doesn’t help you get connected, you may try setting SQL Server Browser service to Automatic and start the service.

Failed to map the path…”

When you create a new .NET Web application under a default Web site in IIS 7 (so the URL of your new Web application will be http://localhost/mywebsite, for example), you may encounter an error saying "Failed to map the path…".

To get rid of this error, make sure that the application pool of your new .NET Web application and the application pool of the default Web site are the same.  The following pictures show the cause of the error:

default_web_site

new_web_app

Change the application pool of the latter one to be the same of the first one solves the problem Angel

This row already belongs to another table.”

When you try to add a DataRow from one table to another, you may encounter the following error message:

"This row already belongs to another table."

This error message appears if you try to add (copy) a DataRow from table1 to table2, for example, with the following C# code:

table2.Rows.Add(row);

where row is a DataRow object from table1.

To successfully copy the row, you’ll need to use ImportRow() method:

table2.ImportRow(row);

Don’t forget to define a proper value of column number for table2 first or no data will be displayed if you bind table2 with a gridview, for example.

WSS 3.0 Security Groups

In WSS 3.0, there are three (3) out-of -box security groups.

  1. Owners (Full-Control)
    • Get full access to the entire site and its subsites.
  2. Members (Read/Write)
    • Have "Contribute" permission level associated.  This "Contribute" permission level gives members quite a bit of power and could be out of control sometimes.
    • Members cannot see "Site Actions" button and those items hidden by an admin.  However, by default, they CAN edit and delete an item created by an admin!!! ("Contribute" permission level)
  3. Visitors (Read-Only)
    • Though visitors cannot see the "Site Actions" button, cannot do site personalization, and cannot edit or delete items, they, by default, CAN modify a shared document -*-
    You can create your own SharePoint groups.
    MOSS 2007 comes with more out-of-box groups.

<< Back to [70-631] TS: Configuring Microsoft Windows SharePoint Services (WSS) 3.0 – Exam Notes

www.localhost.com Nightmare

When you’re working with Visual Studio and trying to run a web application project, you may encounter a problem of the URL change from http://localhost to http://www.localhost.com

This is caused by the IPv6 issue.  Look in your hosts file (usually located under C:WindowsSystem32driversetc).  Look for the line:

::1    localhost

Comment it out with a # sign and it’ll become:

#::1    localhost

That’s it. You’re now up and running Hot

IIS7 – Authorization Failure – Cannot verify access to path…

Authorization_Failure
Authorization_Local_User
Authorization_Success

When creating a new web application in IIS 7, you may encounter an authorization failure when clicking on the “Test Settings…” button as shown in the first picture. This is because the Web application is configured to use pass-through authentication which somehow may not have enough permission to access the physical folder of the Web application. Skull
One way to work around is to create a new local user and give it an administrator role. In my case, I setup a new administrator account and named it “iis”. Now click on the “Connect As…” button to set a new user for this connection and, of course, use the created one.
After clicking OK and test the settings, you will not get any warning message again. Big Grin