使用 ID NO 亚音速搜索

发布于 2024-10-18 12:46:35 字数 352 浏览 0 评论 0原文

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”是一个“属性”,但像“类型”一样使用

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

The .Select is giving me problems. Its saying that 'Health_Scheme_System.Health_Scheme_SystemDB.Select' is a 'property' but is used like a 'type'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我是有多爱你 2024-10-25 12:46:35

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

Remove the new - you are not creating a new instance so you shouldn't use new.

攒一口袋星星 2024-10-25 12:46:35
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>();

    }

然后用这段代码绑定网格视图。显然,文本框中输入的数据只会显示在网格视图中。

 gvView.DataSource = da.GetID(txtIDNO.Text);
        gvView.DataBind();
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>();

    }

Then bind the grid view with this code. obviously there the data input in the textbox only will be displayed in the gridview.

 gvView.DataSource = da.GetID(txtIDNO.Text);
        gvView.DataBind();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文