前几日有学员反映按照《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:
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相关资料。
出错信息为:“错误 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 NorthwindsTableAdapters;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相关资料。
我抬头仰望,星星给予仰望者光芒……