《Scott Mitchell 的ASP.NET 2.0資料教程》之二 BLL層 學習過程中的問題

來源:互聯網
上載者:User
前幾日有學員反映按照《Scott Mitchell 的ASP.NET 2.0資料教程之二》中的例子仿寫,結果無法運行程式,報錯誤,找不到名為"NorithwindTableAdapters"的命名空間,導致程式無法運行。
出錯資訊為:“錯誤 1 找不到類型或命名空間名稱“NorithwindTableAdapters”(是否缺少 using 指令或程式集引用?) D:\Code\Northwind\Web\App_Code\BLL\Categories.cs 10 7 D:\...\Web\
”。
遇到這種問題可以通過GOOGLE搜尋,得到想要的答案,老外是這樣回答的(參見http://forums.asp.net/t/1010504.aspx):
 I was able to fix this, though I still don't understand why it happens.

As Mr. Freeman (great job against the Xen, by the way) mentioned, the namespace is auto-generated by VS.Net. You can find out what namespace it created by opening the Class View and looking for the namespace objects (they look like braces: {}), in my case:

namespace Northwind sTableAdapters;

Notice the bold "s"? Changing the code to this namespace worked. Why VS did this I have no idea, neither VS nor the tutorial gives any indication where this name comes from.

I typed the code in myself rather than downloading it; I find I don't learn anything by downloading and running samples.
意思就是說:請開啟你VS.NET 2005的“類別檢視”視窗,尋找你的命名空間究竟為什麼,注意這裡的命名空間應該是帶"S"的命名,然後在程式中引用即可。

另外,其中用到了設計模式的“單件”模式,不清楚的同學請Google相關資料。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.