views:

24

answers:

1

The error::

The type or namespace name 'NorthwindTableAdapters' could not be found (are you missing a using directive or an assembly reference?)

I am following the tutorial below and doing exactly like it says

http://www.asp.net/data-access/tutorials/creating-a-data-access-layer-cs

but getting this error..tried everything to make it go away

  1. Added the line of code in my file "using NorthwindTableAdapters; "
  2. tried steps like the following ques's answers say

http://stackoverflow.com/questions/2555183/asp-net-dal-datasset-and-table-adapter-not-in-namespace-northwind-tutorial

A few questions::

  1. Is there supposed to be a NorthWindAdapter class coz I cant see one in the solution explorer

  2. Also my DB's name is "myDB" so do I need to write "using myDBTableAdapters;" instead of "using NorthwindTableAdapters;" ?? I did try this but it didnt work

My code:-

Default.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(); 
    }
}

Should I type xsd file's code here ??

what's wrong ?? Help!

A: 

Hey,

Two things:

  1. Just in case, make sure the DLL where the dataset resides in is in the bin of the web application, and
  2. Double-check the designer generated file, and check the namespaces of the table adapters. Ctrl + F and type ProductsTableAdapter, then drill up to find the namespace... typically the namespace is longer.

HTH.

Brian