Solved

entity framework  - The value can not be null.

Posted on 2010-08-18
5
777 Views
Last Modified: 2013-11-11
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
0
Comment
Question by:enrique_aeo
  • 3
  • 2
5 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
Comment Utility
Does "actividad" have a non-null EntityKey?
0
 

Author Comment

by:enrique_aeo
Comment Utility
which verify that?
0
 
LVL 23

Expert Comment

by:Jens Fiederer
Comment Utility
Put a breakpoint on the line of code where it reads
      db.GetObjectByKey(actividad.EntityKey)

when the breakpoint is hit, use QuickWatch to inspect "actividad".

See if EntityKey was set.
0
 

Author Comment

by:enrique_aeo
Comment Utility
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
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
Comment Utility
Could you use CreateEntityKey before making the call like in

http://msdn.microsoft.com/en-us/library/dd283138.aspx
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now