I am about to create an Application Form with UUID as its unique key (not primary key).
I got the error:
An exception of type 'System.Data.Entity.Core.EntityCommandExecutionException' occurred in EntityFramework.SqlServer.dll but was not handled in user code Additional information: An error occurred while executing the command definition. See the inner exception for details.
Connection String To DB:
connectionString="Data Source=(localdb)\v11.0;
Initial Catalog=FormsContext;
Integrated Security=True;
MultipleActiveResultSets=True;
AttachDbFilename=|DataDirectory|Forms.mdf"
providerName="System.Data.SqlClient"
FormsContext.cs:
namespace ApplicationForm.Models
{
public class FormsContext : DbContext
{
public FormsContext() : base("name=FormsContext")
{
}
public System.Data.Entity.DbSet<ApplicationForm.Models.Form> Forms { get; set; }
...
The database is like this:
FormsContext->Forms->{id,uuid,first,last...}
I am not so sure what happened this time. Would anyone help me to go through this?
Edit/Resolution
I wasn't sure how to check Inner Exception and I did some research on this. So when I read the error message in the Inner Exception, I could solve my problem.
I found out what the bug was. The query field is 'firstname' but my table column name is 'first'. They did not match. Once I changed the DB column name, it was working again.