使用ID搜索没有亚音速

时间:2011-02-21 13:10:18

标签: search subsonic3

public List<EmployeeDirectory> employee = new Health_Scheme_SystemDB.Select
    .From<EmployeeDirectory>()
    .Where(EmployeeDirectoryTable.ID_NOColumn).Contains(1005)
    .ExecuteTypedList<EmployeeDirectory>();

.Select给了我一些问题。它说“Health_Scheme_System.Health_Scheme_SystemDB.Select”是一个“属性”,但用作“类型”

2 个答案:

答案 0 :(得分:0)

删除new - 您没有创建新实例,因此不应使用new

答案 1 :(得分:0)

public List<EmployeesX> GetID(string IDNO)
    {
        Health_Scheme_System.Health_Scheme_SystemDB db = new Health_Scheme_System.Health_Scheme_SystemDB();

        var d = (from c in db.EmployeeDirectories
                 where c.ID_NO.Contains(IDNO)
                 select new EmployeesX { ID_NO = c.ID_NO, FIRST_NAME = c.FIRST_NAME, LAST_NAME = c.LAST_NAME, EMPLOYMENT_DATE = ((DateTime)c.EMPLOYMENT_DATE).Date, TERMINATION_DATE = ((DateTime)c.TERMINATION_DATE).Date, LOCATION_CODE = c.LOCATION_CODE });

        return d.ToList<EmployeesX>();

    }

然后使用此代码绑定网格视图。显然,只有文本框中的数据输入才会显示在gridview中。

 gvView.DataSource = da.GetID(txtIDNO.Text);
        gvView.DataBind();