如何退出当我单击另一个时正在运行的函数

时间:2016-09-21 05:27:52

标签: c# asp.net

这是一个示例函数。如何在运行时退出此函数以运行另一个函数?

public Dictionary<long, int> GetCommitByDays(string username, int queryDays)
{
    /*0 means today */
    queryDays--;
    Dictionary<long, int> commitNumber = new Dictionary<long, int>();
    SqlConnection conn = connectLocaldb.ConnectDataBase();           
    conn.Open();           
    SqlCommand querySingleInfo = conn.CreateCommand();
    querySingleInfo.CommandText = "SELECT CONVERT(varchar(12), CommitTime, 111) as querydate, COUNT(CONVERT(varchar(12), CommitTime, 112)) as queryTimes FROM MemberCommitBeforeCompiling  where UserName='xiehongguang' and DATEADD(d,-"+queryDays+", CONVERT(varchar(12), getdate(), 112)) <= CONVERT(varchar(12), CommitTime, 112)  group by CONVERT(varchar(12), CommitTime, 111) order by CONVERT(varchar(12), CommitTime, 111)desc";
    SqlDataReader singleInfoReader = querySingleInfo.ExecuteReader();
   /*.....*/
    singleInfoReader.Close();
    conn.Close();
    return commitNumber;
}

0 个答案:

没有答案