我遇到了以下错误信息,我正在使用petaPOCO。为什么会出现这个错误信息?我做错了什么导致出现这个信息:
捕获了System.InvalidOperationException异常 消息=已经有一个与此命令相关联的打开的DataReader,必须先关闭它。 来源=System.Data 堆栈跟踪: 在System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command) 在System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) 在System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) 在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) 在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) 在System.Data.SqlClient.SqlCommand.ExecuteScalar() 在PetaPoco.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) 中。C:\Dev\Code\API\Models\PetaPoco.cs:第1243行 内部异常:
{"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 command) 在System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command) 在System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async) 在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) 在System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) 在System.Data.SqlClient.SqlCommand.ExecuteScalar() 在PetaPoco.Database.Insert(String tableName, String primaryKeyName, Boolean autoIncrement, Object poco) 中。C:\Dev\Code\API\Models\PetaPoco.cs:第1243行 内部异常: