Several days ago, some students reported that they could not run according to the example in Scott Mitchell's ASP. NET 2.0 data tutorial II. Program An error is reported. The namespace named "norithwindtableadapters" cannot be found, causing the program to fail.
Error message: "error 1 cannot find the type or namespace name" norithwindtableadapters "(is the using command or assembly reference missing ?) D: \ code \ northwind \ WEB \ app_code \ BLL \ categories. CS 10 7 d: \... \ WEB \
".
If you encounter this problem, you can search by Google to get the desired answer. Foreigners answer this question (see 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. 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.
That is to say: Open the "Class View" window in vs. NET 2005 to find out why your namespace is. Note that the namespace here should contain"S", And then reference it in the program.
In addition, the "one-piece" mode of the design mode is used. If you are not clear about it, please google related documents.