检索数据时出错. [英] error while retrieving data.

查看:95
本文介绍了检索数据时出错.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检索数据时出现错误.错误是

I am getting error while retrieving data. error is

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();
            }
        }



请帮我谢谢.

问候
sreekanth.



please help me thank you.

regards
sreekanth.

推荐答案

System.NotImplementedException:方法或操作未实现.
错误不是不言自明的吗?您尝试使用的方法在范围中不存在.

使用Visual Studio DEBUGGER将使您准确地到达此错误所在的行,并且您可以亲自看到预期/尝试使用的方法在范围内丢失.

至于上面共享的代码,我看不到任何会引发它的外部消息调用.因此,启动您的应用程序,将DEBUGGER放在开始本身,然后逐步进行.查看从哪里得到错误.
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.


这篇关于检索数据时出错.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆