Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting error while retrieving data. error is
VB
System.NotImplementedException: The method or operation is not implemented.

code is

public List<Emp> GetEmp()
        {
            try
            {
                List<Emp> lst = new List<Emp>();
                string query = "Select empid, emmpname, jobid, managerid, hiredate, salary, comm, departmentid from employee";
                con = new SqlConnection(connect);
                cmd = new SqlCommand(query, con);
                con.Open();
                dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    Emp e = new Emp();
                    e.empid = (int)dr["empid"];
                    e.empname = dr["emmpname"].ToString();
                    e.jobid = (int)dr["jobid"];
                    e.managerid = (int)dr["managerid"];
                    e.hiredate = (DateTime)dr["hiredate"];
                    e.salary = (int)dr["salary"];
                    e.comm = (int)dr["comm"];
                    e.deptid = Convert.ToInt32(dr["departmentid"]);
                    lst.Add(e);
                }
                return lst;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }


please help me thank you.

regards
sreekanth.
Posted
Comments
Bernhard Hiller 27-Jun-12 4:51am    
I think that error happens somewhere else.
You can omit that catch-throw statement, as it only destryos the callstack. And the callstack is the important point here: it will show you where the error actually happened.
My guess is: it hapens in a property set of "Emp" - debug / use the callstack to identify the correct position.

1 solution

System.NotImplementedException: The method or operation is not implemented.
Is not the error self-explanatory? Method that you are trying to use does not exist in the scope.

Use of Visual Studio DEBUGGER will take you exactly to the line where this error is and you can see for yourself that the method expected/tried to be used is missing in the scope.

As for code shared above, I don't see any external message call that will raise it. So, start your application, put DEBUGGER at the start itself and go step-by-step. See where you get the error.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900