enrique_aeo
asked on
entity framework - The value can not be null.
I have this error
The value can not be null.
Parameter name: key
view attached EFerror
I am using visual studio 2008
actividadEDM.jpg
EFerror.jpg
EF01.jpg
The value can not be null.
Parameter name: key
view attached EFerror
I am using visual studio 2008
actividadEDM.jpg
EFerror.jpg
EF01.jpg
Does "actividad" have a non-null EntityKey?
ASKER
which verify that?
Put a breakpoint on the line of code where it reads
db.GetObjectByKey(activida d.EntityKe y)
when the breakpoint is hit, use QuickWatch to inspect "actividad".
See if EntityKey was set.
db.GetObjectByKey(activida
when the breakpoint is hit, use QuickWatch to inspect "actividad".
See if EntityKey was set.
ASKER
it does not. View file
this is the code the table
CREATE TABLE [certifica].[Actividad](
[Codigo] [int] IDENTITY(1,1) NOT NULL,
[CodigoActividad] [bigint] NOT NULL,
[NombreActividad] [varchar](200) NULL,
[NombreSede] [varchar](50) NULL,
[FechaInicio] [varchar](50) NULL,
[FechaFin] [varchar](50) NULL,
[DirigidoA] [varchar](200) NULL,
[NombrePrograma] [varchar](200) NULL,
[NumeroResolucion] [varchar](100) NULL,
[HorasLectivas] [varchar](5) NULL,
PRIMARY KEY CLUSTERED
(
[CodigoActividad] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
enitysetKEYname.jpg
this is the code the table
CREATE TABLE [certifica].[Actividad](
[Codigo] [int] IDENTITY(1,1) NOT NULL,
[CodigoActividad] [bigint] NOT NULL,
[NombreActividad] [varchar](200) NULL,
[NombreSede] [varchar](50) NULL,
[FechaInicio] [varchar](50) NULL,
[FechaFin] [varchar](50) NULL,
[DirigidoA] [varchar](200) NULL,
[NombrePrograma] [varchar](200) NULL,
[NumeroResolucion] [varchar](100) NULL,
[HorasLectivas] [varchar](5) NULL,
PRIMARY KEY CLUSTERED
(
[CodigoActividad] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
enitysetKEYname.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.