日期:2014-05-20  浏览次数:20657 次

Linq错误.
//testDataContext test=new testDataContext ();
  // var query1 = from t in test .TeacherInfo select t.TeaBirth.Value.Year.ToString();
  // DropDownList1.DataSource = query1;
  // DropDownList1.DataBind();
错在哪里?

------解决方案--------------------
var query1 = from t in test.TeacherInfo select t.TeaBirth;
foreach(string q in query1) 

ListItem item =new ListItem(); 
item.value = q.TeaBirth.Value.Year.ToString();
DropDownList1.Items.Add(item); 
}