-2

まあ、私は質問がそれ自体を物語っていると思います。これをより明確にするコード (test.cs) を次に示します。

        while (reader.Read())
        {
            string sessieVak = reader["vak"].ToString();
            if (variable == "cool")
            {
                //This part can only happen once in the entire application 
                HttpContext.Current.Session[sessieVak] = true;
            }
            if (HttpContext.Current.Session[sessieVak] != null)
            {
                str.Append("<li><a href = vak.aspx?id=" + reader["kdv_ID"] + " />" + reader["vak"] + "</a></li>");
            }
        }

皆さんが私を助けてくれることを願っています。前もって感謝します。

4

1 に答える 1

1

static boola をフラグとして使用できます。

static bool done = false;    

if (variable == "cool" && done == false)
{
    //This part can only happen once in the entire application 
    HttpContext.Current.Session[sessieVak] = true;
    done = true;
}
于 2013-10-16T09:36:25.973 に答える