我的控制器上出现此错误
System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> MySql.Data.MySqlClient.MySqlException: There is already an open DataReader associated with this Connection which must be closed first.
at MySql.Data.MySqlClient.MySqlCommand.CheckState()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.Entity.EFMySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.Execute(MergeOption mergeOption)
at System.Data.Objects.DataClasses.EntityReference`1.Load(MergeOption mergeOption)
at System.Data.Objects.DataClasses.RelatedEnd.Load()
at System.Data.Objects.DataClasses.RelatedEnd.DeferredLoad()
at System.Data.Objects.DataClasses.EntityReference`1.get_Value()
at Timee.fingerprint.get_employee() in C:\Users\MyNameDesktop\Time\Timee\AModel.Designer.cs:line 2234
at Timee.BundyForm.verificationControl_OnComplete(Object Control, FeatureSet FeatureSet, EventHandlerStatus& EventHandlerStatus) in C:\Users\MyName\Desktop\Time \Timee\BundyForm.cs:line 82
at DPFP.Gui.Verification.VerificationControl.<>c__DisplayClass2.<relay_OnComplete>b__0()
控制器:
void verificationControl_OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
{
clearInfoBoxTimer.Stop();
DateTime entryTime = DateTime.Now;
DPFP.Verification.Verification ver = new DPFP.Verification.Verification();
DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();
employee employees = null;
foreach (fingerprint fingerPrint in this.db.fingerprints)
{
DPFP.Template template = new DPFP.Template();
template.DeSerialize(fingerPrint.data);
ver.Verify(FeatureSet, template, ref res);
if (res.Verified)
{
employees = fingerPrint.employee; //Im GETTING AN ERROR HERE
break;
}
}
}
根据我阅读的一些论坛,我必须添加multipleactiveresultsets=True;
到我的 webconfig 中。但就我而言,它不适用,因为我使用的是不支持它的 MYSQL。还有其他方法可以使这项工作吗?请各位大侠帮帮我,谢谢。
验证模型
// Summary:
// Performs the system function of fingerprint verification, which is a one-to-one
// comparison of a fingerprint feature set with a fingerprint template produced
// at enrollment that returns a decision of match or non-match.
public class Verification
{
// Summary:
// Use this value to specify the default FAR threshold
public const int ProbabilityNotSet = -1;
// Summary:
// Initializes a new instance of the Verification class for comparing a fingerprint
// feature set with a fingerprint template using the default value of the false
// accept rate (FAR)
public Verification();
//
// Summary:
// Initializes a new instance of the Verification class for comparing a fingerprint
// feature set with a fingerprint template and assigns the value of the FAR
//
// Parameters:
// FARRequested:
// Value of the requested FAR
public Verification(int FARRequested);
// Summary:
// Returns or assigns the requested false accept rate (FAR)
public int FARRequested { get; set; }
// Summary:
// Performs fingerprint verification and returns the comparison decision based
// on the default FAR threshold
//
// Parameters:
// FeatureSet:
// A DPFP.FeatureSet object
//
// Template:
// A DPFP.Template object
//
// Returns:
// Verification result object
public static Verification.Result Verify(FeatureSet FeatureSet, Template Template);
//
// Summary:
// Performs fingerprint verification and returns the comparison decision based
// on the specified FAR threshold
//
// Parameters:
// FeatureSet:
// A DPFP.FeatureSet object
//
// Template:
// A DPFP.Template object
//
// FARRequested:
// False Accept probability threshold or ProbabilityNotSet to use the default
// threshold
//
// Returns:
// Verification result object
public static Verification.Result Verify(FeatureSet FeatureSet, Template Template, int FARRequested);
//
// Summary:
// Performs the system function of fingerprint verification and specifies a
// comparison decision based on the FAR set by the FARRequested property
//
// Parameters:
// FeatureSet:
// A DPFP.FeatureSet object
//
// Template:
// A DPFP.Template object
//
// Result:
// A DPFP.Verification.Result object
public void Verify(FeatureSet FeatureSet, Template Template, ref Verification.Result Result);
// Summary:
// Represents the results of a fingerprint verification operation.
public class Result
{
// Summary:
// Default c-tor
public Result();
// Summary:
// Returns or assigns the value of the achieved FAR for a comparison operation.
public int FARAchieved { get; set; }
//
// Summary:
// Returns or assigns the comparison decision, which indicates whether the comparison
// of a fingerprint feature set and a fingerprint template resulted in a decision
// of match or non-match. This decision is based on the value of the FARRequested
// property
public bool Verified { get; set; }
}
}