抛出新的NotImplementedException() [英] throw new NotImplementedException()
本文介绍了抛出新的NotImplementedException()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的代码不断引发异常,并引发新的NotImplementedException(),我不确定如何解决它.我正在尝试捕获下面的存储过程返回的日期时间.
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.
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
@山姆 这是设计师所实现的
@Sam This is what's implemented by the designer
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;
}
推荐答案
它就在您的代码中
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.
您应该实现spMaxDateinGreeks
,或者停止调用它.
You should either implement spMaxDateinGreeks
, or stop calling it.
这篇关于抛出新的NotImplementedException()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文