2011年7月6日 星期三

使用SQL 2008 SQL Server Management Studio 更改資料表結構 出現錯誤訊息不允許儲存變更

今天在修改SQL Server欄位資料時
跳出了這個錯誤
不允許儲存變更。 您所做的變更會需要下列資料表卸除並重新建立。 您有做任何變更一個資料表,無法重新建立或啟用選項會防止儲存變更,需要重新建立資料表。
可以用下列的方式來修改
請參考這裡

2011年7月1日 星期五

ServiceAccount設定

ServiceAccount設定為 ServiceAccount.User時

在安裝的過程中會要求帳號密碼
記得帳號需要加上電腦的名稱
ComputerName \ UserName

可參考 這裡

效能計數器登錄區已損毀 windows7

安裝MS SQLServer 2008時出現了這個問題
上網查了一下
發現要改註冊碼
可以參考 這裡 來做修正
這幾天安裝程式還真累人 ...

2011年6月28日 星期二

抓取檔案目前的權限狀態

因為要設定檔案的權限
而且不想改變該檔其他帳號的權限
所以用了下方的方式去抓取 以及設定


        private static void SetAccessRule(
            string fileName
            , string accountName
            , FileSystemRights rights
            , AccessControlType controlType)
        {
            var account
                = new NTAccount(accountName);

            var accessRule
                = new FileSystemAccessRule(account, rights, controlType);

            var securityDescriptor
                = new FileSecurity(fileName, AccessControlSections.Access);
         
            var accessRuleCollection
                = securityDescriptor.GetAccessRules(true, true, typeof(NTAccount));
         
            securityDescriptor.SetAccessRule(accessRule);

            File.SetAccessControl(fileName, securityDescriptor);

        }

2011年6月27日 星期一

installutil.exe - Win 7下注意事項

因為win7的權限控管
所以在使用installutil 時
記得要先用 Adminstrator 的角色 開啟 Visual Studio的 command 工具列
否則會一直收到 system.security.securityexception the source was not found ... 的 Exception

2011年6月16日 星期四

Recursive queries

在PTT的CSherp板看到的問題
沒遇到這種需求
記錄一下 晚點來看看

reference:

SQL Server:
http://www.mssqltips.com/tip.asp?tip=938

Oracle:
http://rwijk.blogspot.com/2009/11/recursive-subquery-factoring.html

2011年6月9日 星期四

關於private / protect 方法是否該測試

如果該方法是很重要的
是可以用Reflection的方法去做

http://www.cnblogs.com/confach/articles/225502.html


visual studio 2010似乎有提供方法可以測試
晚點來試試看

http://msdn.microsoft.com/zh-tw/library/bb385974.aspx