gpt4 book ai didi

c# - 抛出新的 NotImplementedException()

转载 作者:太空狗 更新时间:2023-10-29 18:00:31 26 4
gpt4 key购买 nike

下面的代码不断抛出异常 throw new NotImplementedException() 并且我不确定如何修复它。我正在 try catch 下面存储过程返回的日期时间。

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

编辑:@山姆这是设计者实现的

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

它的意思就是它所说的,你的方法还没有实现。它什么都不做。它仅用作占位符。

您应该实现 spMaxDateinGreeks,或者停止调用它。

关于c# - 抛出新的 NotImplementedException(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16303718/

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