8

以下のコードは例外 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これはデザイナーによって実装されたものです

 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;
        }
4

1 に答える 1

56

それはあなたのコードにあります

private DateTime spMaxDateinGreeks(ref DateTime? test)
{
    throw new NotImplementedException();
}

それはまさにそれが言うことを意味します、あなたの方法はまだ実装されていません。それは何もしません。プレースホルダーとしてのみ存在します。

を実装するかspMaxDateinGreeks、呼び出しを停止する必要があります。

于 2013-04-30T15:39:11.193 に答える