-3

C# および ASP.Net Web フォームを使用して、Visual Studio 2010 でサイトを作成しています。壊れて間違った理由がわかりませんオンラインチュートリアルに従って他の問題を修正した後、コードにこのエラーが発生し、修正方法や何が間違っていたのかわかりません。私は知っています。

using System;
using System.Collections;
using System.Configuration;
using System.Data.SqlClient;

public class ConnectionClass
{
private SqlConnection conn;
private SqlCommand command;

ConnectionClass()
{
    string connectionString = ConfigurationManager.ConnectionStrings["Connection"].ToString();
    conn = new SqlConnection(connectionString);
    command = new SqlCommand("", conn);
}

private ArrayList GetClothesByType(string ClothesType)
{
    ArrayList list = new ArrayList();
    string query = string.Format("SELECT * FROM fusey WHERE type LIKE '{0}'", ClothesType);

    try
    {
        conn.Open();
        command.CommandText = query;
        SqlDataReader reader = command.ExecuteReader();

        while (reader.Read())
        {
            int id = reader.GetInt32(0);
            string name = reader.GetString(1);
            string type = reader.GetString(2);
            double price = reader.GetDouble(3);
            string size = reader.GetString(4);
            string image = reader.GetString(5);
            string review = reader.GetString(6);

            Fusey fusey = new Fusey(id, name, type, price, size, image, review);
            list.Add(fusey);
        }
    }
    finally
    {
        conn.Close();
    }

    return list;
}



internal static ArrayList GetClothesByType(object ClothesType)
{
    throw new NotImplementedException();
}
}
4

2 に答える 2

2

実装されていない例外が発生していますか? それは実装されていないためです。

internal static ArrayList GetClothesByType(object ClothesType)
{
    throw new NotImplementedException(); // you need to implement this method
}

コードのどこにもこれを呼び出しているところはありませんが、どこかにあり、そうするとこの例外が発生すると思います。

興味がある場合は、NotImplementedException に関する MSDN ドキュメント

また、オーバーロードがあることもわかりました-- メソッド呼び出しを混乱させ、 の代わりにGetClothesByTypeを渡して、間違った実装されていないメソッドを呼び出している可能性があります。objectstring

あなたが電話している場所のコードを見せていただけますGetClothesByTypeか?

于 2013-04-24T17:57:45.240 に答える