Searching with ID NO subsonic

38 views Asked by At
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'

2

There are 2 answers

0
Malcolm On
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();
2
ThiefMaster On

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