我遇到以下錯誤消息,我正在使用petaPOCO。爲什麼我在此錯誤消息,什麼我做錯了有這個消息:找不到異常消息
{"There is already an open DataReader associated with this Command which must be closed first."}
This is what I have been able to copy for the exception message.
System.InvalidOperationException了抓 消息=已經有一個與此相關聯的打開的DataReader必須先關閉的命令。 源= System.Data 堆棧跟蹤: 在System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand的命令) 在System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(字符串方法,SqlCommand的命令) 在System.Data.SqlClient的。 SqlCommand.ValidateCommand(String method,Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String method,DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String方法) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at PetaPoco.Databas e.Insert(字符串表名,字符串primaryKeyName,布爾自動增量,對象POCO)在C:\開發\代碼\ API \模型\ PetaPoco.cs:線1243 的InnerException:
顯示正在使用DataReader的代碼 – Andy 2012-03-01 07:01:33
您使用的是db.Query方法嗎? – patmortech 2012-03-01 11:12:20
請添加一些數據訪問邏輯代碼。 – 2012-03-06 08:36:31