Saturday, December 20, 2008

Force Windows XP Explorer to Sort By Name

I am an old fashioned Windows user, I don't like current Windows XP Windows Explorer sorting method, which it can "remember" your settings for each folder. Instinctly I think it will waste disk space. I always missed the old Windows sorting method that is always sort files by file name, only when I tell it to sort by date, it will sort by date, but once I close it and reopen it, I hope it still sort by name instead of sort by date. And I once and always use the "detail" view of Windows Explorer.

This works perfectly before when I choose to "Not remember settings for each folder". But one day, for some unknown reason, it just can not work. Everytime I open Windows Explorer, it always sort files by date, as I did not choose "remember" settings, it will sort by date for EVERY single folder. This is really annoying and frustrating. I tried many ways to solve this problem, I sort the folders by name, then close Windows Explorer, it has no effect, next time when I open it, it still sort by date. I even tried somebody's suggestion, that is to click Ctrl plus the close button on top right corner, still same, no effect. I tried to change the "remember" setting back and forward, hope it can remember to sort by file name, well, still same, once I enable it to "remember", it remember to sort by file name, but once I change it back to "not remember", it remember to sort by date!

I tried to think what I might do before, and I noticed everytime I open Windows Explorer, it will firstly go to the page of "My Computer" which will list all my hard disks, in this view, there is no sorting method above like other folders' detail view does. But, you still can click the above column head to sort it, I tried to click all the column headers one by one, and finally go back to sort by type, then close Windows Explorer. Guess what? Next time I open it, everything works as I wish! My computer view show hard disks together as sort by type, My documents view sort files by file name, my D drive, H drive, I drive all sort by file name now.

Seems the "sort by filename" is related to "sort by type" for My Computer view. If you have similiar issue, please try this way, and let me know your result.

Wednesday, December 17, 2008

How to insert a data source in SharePoint Designer 2007?

Actually, the difficulty is caused by a bug of Microsoft. Below are detail steps:


1. Click "Connect to a database" in "Database connections", click Configure database connection, click Use Custom String, click Edit, select "Provider for OLEDB" and type the following connection string:


Provider=OraOLEDB.Oracle;Data Source=wise;Persist Security Info=True;User ID=wiseq;Password=wiseq;Unicode=True


(Replace the parameters for Data Source, User ID and Password with your own)


2. Click Next and you will see an error which says "an error occurred while retrieving the list of tables from the root Database", click OK, click "Specify custom Select, Update, Insert…", click Edit Command and type the command which looks like:


select * from project


click Finish, click OK.


3. Then, expand the left pane of SharePoint designer, expand _catalogs--fpdatasources, you will find a new xml file whose name is the same as your connection name generated. Double click it to open it. The current string shows


<udc:DataSource xmlns:udc="" MajorVersion="2" MinorVersion="0">



<DataSourceControl><CDATA><asp:SqlDataSource id="SqlDataSource1" runat="server" __designer:Provider="OraOLEDB.Oracle" __designer:customcommand="true" ProviderName="System.Data.SqlClient" __designer:customconnectionstring="true" SelectCommand="select p.deptno, p.dname from scott.dept p" ConnectionString="Data Source=wise;Persist Security Info=True;User ID=wiseq;Password=wiseq;Unicode=True;Initial Catalog=root;" /></CDATA></DataSourceControl>


<udc:Type MajorVersion="1" MinorVersion="0" Type="Sql"/>



You can modify the provider name and delete the Initial Catalog. The expected result looks like


<udc:DataSource xmlns:udc="" MajorVersion="2" MinorVersion="0">

<udc:Name>Custom Query</udc:Name>


<DataSourceControl><CDATA><asp:SqlDataSource runat="server" ConnectionString="Data Source=wise;User ID=wiseq;Password=wiseq;" ProviderName="System.Data.OracleClient" ID="SqlDataSource1" SelectCommand="select p.deptno, p.dname from scott.dept p" __designer:Provider="OraOLEDB.Oracle" _designer:customcommand="true" __designer:customconnectionstring="true"></asp:SqlDataSource></CDATA></DataSourceControl>


<udc:Type MajorVersion="1" MinorVersion="0" Type="Sql"/>



4. Save the xml. When you click Show Data and you should able to see the data populated.