我使用的是ASP.NET 3.5。我做了一个表单,当用户点击一个按钮时,它应该是laod另一个页面上的信息。我得到的不是加载,而是这个错误页面:
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();
}
}发布于 2011-11-16 03:11:24
您正在调用的特定方法(考虑到它不是类库方法)很可能是专门执行此操作的:
throw new NotImplementedException();它现在只是一个存根。这是您的解决方案中的代码;因此,在您的页面上,您的方法可能未实现。
发布于 2011-11-16 03:16:31
您或其他人可能已经使用Visual Studio自动代码生成技术添加了GetPersonnel()方法,该技术会在代码中插入NotImplementedException行,您必须手动删除它。
在您的GetPersonnel()方法中,删除throw new NotImplementedException...行,并完全实现该方法以返回一些与该方法的返回类型匹配的值。
发布于 2011-11-16 03:11:16
此错误意味着正在加载的页未实现GetPersonnel方法,该方法在加载过程中由其代码访问。我认为您应该检查正在加载的页面的源代码,并实现此方法。
https://stackoverflow.com/questions/8141730
复制相似问题