gpt4 book ai didi

c# - System.NotImplementedException 错误

转载 作者:太空狗 更新时间:2023-10-29 22:09:40 25 4
gpt4 key购买 nike

我正在使用 ASP.NET 3.5。我制作了一个表单,当用户单击一个按钮时,它应该加载另一个包含信息的页面。我没有加载而是收到此错误页面:

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

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

这是可能出错的代码。我想我可能有些不对劲:

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

最佳答案

您正在调用的特定方法(考虑到它不是类库方法)很可能是专门这样做的:

 throw new NotImplementedException();

它现在是一个 stub 。这是您解决方案中的代码;所以在你的页面上,你的方法可能没有实现。

关于c# - System.NotImplementedException 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8141730/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com