HRAppBUG調試紀錄

來源:互聯網
上載者:User

1、Submit 操作失敗。更新條目時出錯。有關詳細資料,請參見內部異常。 InnerException 訊息: 不能在具有唯一索引 'AK_Employee_LoginID' 的對象 'HumanResources.Employee' 中插入重複鍵的行。
語句已終止。
原因:

employee.ManagerID 屬於外鍵,存在與別的表關聯,故需給他賦一個值。
如下所示:
修改 HRApp.Web.csproj中的 OrganizationService.cs 檔案中的以下項:

       public void InsertEmployee(Employee employee)
        {
           ,,,
            employee.ManagerID = 288;
           ...
        }

2、不能註冊使用者
提示不能串連至資料庫。
如果是串連串配置引起的,請修改 HRApp.Web.csproj中的 Web.config 檔案中的以下項:

<!--<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />-->
修改為:
<add name="ApplicationServices" connectionString="data source=yourSQLSERVER;initial catalog=aspnetdb;user id=sa;password=yourPwd" />

如果你SQL資料庫沒有aspnetdb,運行"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe",通過ASP.NET SQL Server安裝嚮導建立。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.