首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >System.NotImplementedException错误

System.NotImplementedException错误
EN

Stack Overflow用户
提问于 2011-11-16 03:08:53
回答 6查看 51.5K关注 0票数 6

我使用的是ASP.NET 3.5。我做了一个表单,当用户点击一个按钮时,它应该是laod另一个页面上的信息。我得到的不是加载,而是这个错误页面:

代码语言:javascript
复制
The method or operation is not implemented. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NotImplementedException: The method or operation is not implemented.

Source Error: 

    public static dsPersonnel GetPersonnel(string p)
    {
       throw new NotImplementedException();
    } 

Source File:    Line: 203 

我不确定我需要在这里发布什么才能提供足够的帮助信息。

以下是可能出现错误的代码。我想我可能有些地方不对劲:

代码语言:javascript
复制
    public clsDataLayer()
    {

    }

    // This function gets the user activity from the tblPersonnel
    public static dsPersonnel GetPersonnel(string Database, string strSearch)
    {
        dsPersonnel DS;
        OleDbConnection sqlConn;
        OleDbDataAdapter sqlDA;

        //create the connection string 
        sqlConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
        "Data Source=" + Database);

        string query;
        if (strSearch == "" || strSearch.Trim().Length == 0)
        {
            query = "SELECT * from tblPersonnel";
        }
        else
        {
            query = "select * from tblPersonnel where LastName = '" + strSearch + "'";
        }


        // Defines sqlDA and what each will consist of
        sqlDA = new OleDbDataAdapter("select * from tblPersonnel", sqlConn);

        // Defines DS and what each will consist of
        DS = new dsPersonnel();

        // Outputs the results from the information gathered
        sqlDA.Fill(DS.tblPersonnel);

        // Starts over for a new user
        return DS;
    }

    // This function saves the user activity
    public static void SavePersonnel(string Database, string FormAccessed)
    {
        // Defines the connection to the database
        OleDbConnection conn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
            "Data Source=" + Database);
        conn.Open();
        OleDbCommand command = conn.CreateCommand();
        string strSQL;

        strSQL = "Insert into tblPersonnel (UserIP, FormAccessed) values ('" +
            GetIP4Address() + "', '" + FormAccessed + "')";

        command.CommandType = CommandType.Text;
        command.CommandText = strSQL;
        command.ExecuteNonQuery();
        conn.Close();

    }

    public static dsPersonnel GetPersonnel(string p)
    {
        throw new NotImplementedException();
    }
}
EN

回答 6

Stack Overflow用户

回答已采纳

发布于 2011-11-16 03:11:24

您正在调用的特定方法(考虑到它不是类库方法)很可能是专门执行此操作的:

代码语言:javascript
复制
 throw new NotImplementedException();

它现在只是一个存根。这是您的解决方案中的代码;因此,在您的页面上,您的方法可能未实现。

票数 15
EN

Stack Overflow用户

发布于 2011-11-16 03:16:31

您或其他人可能已经使用Visual Studio自动代码生成技术添加了GetPersonnel()方法,该技术会在代码中插入NotImplementedException行,您必须手动删除它。

在您的GetPersonnel()方法中,删除throw new NotImplementedException...行,并完全实现该方法以返回一些与该方法的返回类型匹配的值。

票数 3
EN

Stack Overflow用户

发布于 2011-11-16 03:11:16

此错误意味着正在加载的页未实现GetPersonnel方法,该方法在加载过程中由其代码访问。我认为您应该检查正在加载的页面的源代码,并实现此方法。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8141730

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档