找不到类型或命名空间名称“WeatherDataClassesDataContext”(是否缺少 using 指令或程序集引用?)
程序代码
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.DataSetExtensions;
using System.Data.Entity;
using System.Data.Linq;
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;namespace _555555
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)    
            {
               Bind();
            }
        }
        ///<summary>
        /// 数据绑定
        /// </summary>
        private void Bind()
        {
            // LINQ to SQL
            WeatherDataClassesDataContext ndc = new WeatherDataClassesDataContext();
            var query = from em in ndc.Weather      //查询数据
                        select new
                        {
                            em.CMD_ID,
                            em.Component_ID,
                            em.Timestamp,
                            em.Average_WindSpeed_10min,
                            em.Average_WindDirection_10min,
                            em.Max_WindSpeed,
                            em.Extreme_WindSpeed,
                            em.Standard_WindSpeed,
                            em.Air_Temperature,
                            em.Humidity,
                            em.Air_Pressure,
                            em.Precipitation,
                            em.Precipitation_Intensity,
                            em.Radiation_Intensity,
                            em.Alerm_Flag
                        };
            GridView1.DataSource = query;
            GridView1.DataBind();
        }
    }
}

解决方案 »

  1.   

    WeatherDataClassesDataContext
    是个是别人写的函数吧。
      

  2.   

    我在里面用了LINQ to SQL
      

  3.   

    看看代码有没有 全部copy 完。
      

  4.   

    dll 引用下 试试   应该是调别人写的类把
      

  5.   

    先        private DataClasses1DataContext ndc;//优点是其他方法也可使用
    然后方法里
                ndc = new DataClasses1DataContext();
        var query = from em in ndc.Weather //查询数据
       select new
       {
     。。
    或者直接
                   DataClasses1DataContext ndc = new DataClasses1DataContext();
       var query = from em in ndc.Weather //查询数据
       select new
       {
     。。
      

  6.   

    是别人写的 dll,你需要添加引用。
      

  7.   

    你有没在 解决方案管理器--添加--新项---linq to sql类,再把数据库的表拖进去DataClasses1.dbml?
      

  8.   

    1、先将WeatherDataClassesDataContext所在的程序集引用到项目
    2、using WeatherDataClassesDataContext的命名空间到使用该控件的类中或直接使用全名称
      

  9.   

    看看你的bin debug里面有没有。没有去问别人要一个。