Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

First of all, please note I´ve been checking other questions like this: Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element existUnable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist

but none of them worked for me unfortunately

I am getting the following error message, that happens when there is no primary key on the table:

DbUpdateException was unhandled

Additional information: Unable to update the EntitySet 'Employee' because it has a DefiningQuery and no element exists in the element to support the current operation.

I am getting the error when executing:

...
    ctx.Employee.Add(employee);
    ctx.SaveChanges();
...

However, my table has the primary key defined:

CREATE TABLE [dbo].[Employee] (
    [Id]       INT          NOT NULL,
    [name]     VARCHAR (50) NOT NULL,
    [surname]  VARCHAR (50) NOT NULL,
    [password] VARCHAR (50) NOT NULL,
    [dni]      VARCHAR (50) NOT NULL,
    [phone]    VARCHAR (50) NOT NULL,
    [salary]   VARCHAR (50) NOT NULL,
    [email]    VARCHAR (50) NOT NULL,
    [address]  VARCHAR (50) NOT NULL,
    [postcode] VARCHAR (50) NOT NULL,
    [city]     VARCHAR (50) NOT NULL,
    [province] VARCHAR (50) NOT NULL,
    [admin]    BIT          NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

First of all, please note I´ve been checking other questions like this: Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist

but none of them worked for me unfortunately

I am getting the following error message, that happens when there is no primary key on the table:

DbUpdateException was unhandled

Additional information: Unable to update the EntitySet 'Employee' because it has a DefiningQuery and no element exists in the element to support the current operation.

I am getting the error when executing:

...
    ctx.Employee.Add(employee);
    ctx.SaveChanges();
...

However, my table has the primary key defined:

CREATE TABLE [dbo].[Employee] (
    [Id]       INT          NOT NULL,
    [name]     VARCHAR (50) NOT NULL,
    [surname]  VARCHAR (50) NOT NULL,
    [password] VARCHAR (50) NOT NULL,
    [dni]      VARCHAR (50) NOT NULL,
    [phone]    VARCHAR (50) NOT NULL,
    [salary]   VARCHAR (50) NOT NULL,
    [email]    VARCHAR (50) NOT NULL,
    [address]  VARCHAR (50) NOT NULL,
    [postcode] VARCHAR (50) NOT NULL,
    [city]     VARCHAR (50) NOT NULL,
    [province] VARCHAR (50) NOT NULL,
    [admin]    BIT          NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

First of all, please note I´ve been checking other questions like this: Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist

but none of them worked for me unfortunately

I am getting the following error message, that happens when there is no primary key on the table:

DbUpdateException was unhandled

Additional information: Unable to update the EntitySet 'Employee' because it has a DefiningQuery and no element exists in the element to support the current operation.

I am getting the error when executing:

...
    ctx.Employee.Add(employee);
    ctx.SaveChanges();
...

However, my table has the primary key defined:

CREATE TABLE [dbo].[Employee] (
    [Id]       INT          NOT NULL,
    [name]     VARCHAR (50) NOT NULL,
    [surname]  VARCHAR (50) NOT NULL,
    [password] VARCHAR (50) NOT NULL,
    [dni]      VARCHAR (50) NOT NULL,
    [phone]    VARCHAR (50) NOT NULL,
    [salary]   VARCHAR (50) NOT NULL,
    [email]    VARCHAR (50) NOT NULL,
    [address]  VARCHAR (50) NOT NULL,
    [postcode] VARCHAR (50) NOT NULL,
    [city]     VARCHAR (50) NOT NULL,
    [province] VARCHAR (50) NOT NULL,
    [admin]    BIT          NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);
removed deprecated tag [table] - http://meta.stackexchange.com/questions/198024/can-we-start-cleaning-up-table-tag-and-burninate-it-asap
Link
edited body
Source Link
stuartd
  • 73.1k
  • 16
  • 138
  • 167

Entity not being saved, DbUpdateException was unhandled - C#

First of all, please note I´ve been checking other questions like this: Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist

but none of them worked for me unfortunately

I am getting the following error message, that happens when there is no primary key on the table:

DbUpdateException was unhandled
Additional information: Unable to update the EntitySet 'Employee' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

DbUpdateException was unhandled

Additional information: Unable to update the EntitySet 'Employee' because it has a DefiningQuery and no element exists in the element to support the current operation.

I am getting the error when executing:

...
    ctx.Employee.Add(employee);
    ctx.SaveChanges();
...

However, my table has the primary key defined:

CREATE TABLE [dbo].[Employee] (
    [Id]       INT          NOT NULL,
    [name]     VARCHAR (50) NOT NULL,
    [surname]  VARCHAR (50) NOT NULL,
    [password] VARCHAR (50) NOT NULL,
    [dni]      VARCHAR (50) NOT NULL,
    [phone]    VARCHAR (50) NOT NULL,
    [salary]   VARCHAR (50) NOT NULL,
    [email]    VARCHAR (50) NOT NULL,
    [address]  VARCHAR (50) NOT NULL,
    [postcode] VARCHAR (50) NOT NULL,
    [city]     VARCHAR (50) NOT NULL,
    [province] VARCHAR (50) NOT NULL,
    [admin]    BIT          NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

Any hint?

Thanks in advance.

Entity not being saved, DbUpdateException was unhandled - C#

First of all, please note I´ve been checking other questions like this: Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist

but none of them worked for me unfortunately

I am getting the following error message, that happens when there is no primary key on the table:

DbUpdateException was unhandled
Additional information: Unable to update the EntitySet 'Employee' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

I am getting the error when executing:

...
    ctx.Employee.Add(employee);
    ctx.SaveChanges();
...

However, my table has the primary key defined:

CREATE TABLE [dbo].[Employee] (
    [Id]       INT          NOT NULL,
    [name]     VARCHAR (50) NOT NULL,
    [surname]  VARCHAR (50) NOT NULL,
    [password] VARCHAR (50) NOT NULL,
    [dni]      VARCHAR (50) NOT NULL,
    [phone]    VARCHAR (50) NOT NULL,
    [salary]   VARCHAR (50) NOT NULL,
    [email]    VARCHAR (50) NOT NULL,
    [address]  VARCHAR (50) NOT NULL,
    [postcode] VARCHAR (50) NOT NULL,
    [city]     VARCHAR (50) NOT NULL,
    [province] VARCHAR (50) NOT NULL,
    [admin]    BIT          NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);

Any hint?

Thanks in advance.

Entity not being saved, DbUpdateException was unhandled

First of all, please note I´ve been checking other questions like this: Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist

but none of them worked for me unfortunately

I am getting the following error message, that happens when there is no primary key on the table:

DbUpdateException was unhandled

Additional information: Unable to update the EntitySet 'Employee' because it has a DefiningQuery and no element exists in the element to support the current operation.

I am getting the error when executing:

...
    ctx.Employee.Add(employee);
    ctx.SaveChanges();
...

However, my table has the primary key defined:

CREATE TABLE [dbo].[Employee] (
    [Id]       INT          NOT NULL,
    [name]     VARCHAR (50) NOT NULL,
    [surname]  VARCHAR (50) NOT NULL,
    [password] VARCHAR (50) NOT NULL,
    [dni]      VARCHAR (50) NOT NULL,
    [phone]    VARCHAR (50) NOT NULL,
    [salary]   VARCHAR (50) NOT NULL,
    [email]    VARCHAR (50) NOT NULL,
    [address]  VARCHAR (50) NOT NULL,
    [postcode] VARCHAR (50) NOT NULL,
    [city]     VARCHAR (50) NOT NULL,
    [province] VARCHAR (50) NOT NULL,
    [admin]    BIT          NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);
Source Link
stack man
  • 2.4k
  • 10
  • 38
  • 54
Loading