執行SqlDataReader.Read之後,如果還想用另一個SqlCommand執行Insert或者Update操作的話,會得到一個錯誤提示:There is already an open DataReader associated with this Command which must be closed first.
解決方法是在ConnectionString中加上一個參數“MultipleActiveResultSets”, 將其值設置爲true。
執行SqlDataReader.Read之後,如果還想用另一個SqlCommand執行Insert或者Update操作的話,會得到一個錯誤提示:There is already an open DataReader associated with this Command which must be closed first.
解決方法是在ConnectionString中加上一個參數“MultipleActiveResultSets”, 將其值設置爲true。