C# 抛出新的 NotImplementedException()
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16303718/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
throw new NotImplementedException()
提问by user2321650
the code below keeps throwing an exception throw new NotImplementedException() and I m am not sure how to fix it. I am trying to capture the datetime returned by the stored procedure below.
下面的代码不断抛出异常 throw new NotImplementedException() 我不知道如何修复它。我正在尝试捕获下面存储过程返回的日期时间。
public void FormCarry_Load(object sender, EventArgs e)
{
System.DateTime? test;
test = new System.DateTime(2013, 04, 22);
// spMaxDateinGreeks test2 = new spMaxDateinGreeks();
test = (DateTime)spMaxDateinGreeks(ref test);
monthCalendarAdv1.Value = test.Value;
monthCalendarAdv1.Value = new System.DateTime(2013, 04, 22);
}
private DateTime spMaxDateinGreeks(ref DateTime? test)
{
throw new NotImplementedException();
}
ALTER PROCEDURE [dbo].[spMaxDateinGreeks] (@returneddate datetime OUTPUT)
--spMaxDateinGreeks null
AS
SET NOCOUNT ON;
--if @InqDate is null
Select @returneddate= max(valuationdate)
from Greeks
RETURN
EDIT: @Sam This is what's implemented by the designer
编辑:@Sam 这是设计师实现的
public virtual int spMaxDateinGreeks(ref global::System.Nullable<global::System.DateTime> returneddate) {
global::System.Data.SqlClient.SqlCommand command = ((global::System.Data.SqlClient.SqlCommand)(this.CommandCollection[0]));
if ((returneddate.HasValue == true)) {
command.Parameters[1].Value = ((System.DateTime)(returneddate.Value));
}
else {
command.Parameters[1].Value = global::System.DBNull.Value;
}
global::System.Data.ConnectionState previousConnectionState = command.Connection.State;
if (((command.Connection.State & global::System.Data.ConnectionState.Open)
!= global::System.Data.ConnectionState.Open)) {
command.Connection.Open();
}
int returnValue;
try {
returnValue = command.ExecuteNonQuery();
}
finally {
if ((previousConnectionState == global::System.Data.ConnectionState.Closed)) {
command.Connection.Close();
}
}
if (((command.Parameters[1].Value == null)
|| (command.Parameters[1].Value.GetType() == typeof(global::System.DBNull)))) {
returneddate = new global::System.Nullable<global::System.DateTime>();
}
else {
returneddate = new global::System.Nullable<global::System.DateTime>(((global::System.DateTime)(command.Parameters[1].Value)));
}
return returnValue;
}
采纳答案by Sam I am says Reinstate Monica
It's right there in your code
它就在您的代码中
private DateTime spMaxDateinGreeks(ref DateTime? test)
{
throw new NotImplementedException();
}
It means exactly what it says, Your method is not implemented yet. It doesn't do anything. It's only there as a placeholder.
这正是它所说的意思,您的方法尚未实现。它什么也不做。它仅作为占位符存在。
You should either implement spMaxDateinGreeks, or stop calling it.
您应该实现spMaxDateinGreeks或停止调用它。

