【发布时间】:2010-08-19 10:14:54
【问题描述】:
错误::
找不到类型或命名空间名称“NorthwindTableAdapters”(您是否缺少 using 指令或程序集引用?)
我正在按照下面的教程进行操作,并且完全按照上面的说明进行操作
http://www.asp.net/data-access/tutorials/creating-a-data-access-layer-cs
但出现此错误..尝试了一切以使其消失
- 在我的文件中添加了代码行“using NorthwindTableAdapters;”
- 尝试了类似以下问题的答案的步骤
ASP.net DAL DatasSet and Table Adapter not in namespace - Northwind Tutorial
几个问题::
应该有一个 NorthWindAdapter 类,因为我在解决方案资源管理器中看不到一个
另外,我的数据库名称是“myDB”,所以我需要写“使用 myDBTableAdapters;”而不是“使用 NorthwindTableAdapters;” ??我确实尝试过,但它没有用
我的代码:-
默认.aspx
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
AllProducts.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NorthwindTableAdapters;
public partial class AllProducts : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ProductsTableAdapter productsAdapter = new ProductsTableAdapter();
GridView1.DataSource = productsAdapter.GetProducts();
GridView1.DataBind();
}
}
我应该在这里输入 xsd 文件的代码吗??
怎么了??救命!
【问题讨论】: