Book a Demo

Author Topic: Adding Resource For a Element c#  (Read 8540 times)

Arshad

  • EA User
  • **
  • Posts: 292
  • Karma: +21/-1
    • View Profile
Adding Resource For a Element c#
« on: June 03, 2015, 04:06:04 pm »
Hi was tring to add resources for an element in code base .But was getting null primary key issue .
What have done so far was :(,
Code: [Select]
EA.Resource resource = (EA.Resource)Element.Resources.AddNew("Person", "");
                    resource.Update();

and am getting the following error :'(...!!

[highlight]DAO.Recordset [3058] Index or primary key can't contain a Null value.[/highlight]
What was i doing wrongly  :-[ :-[ ..? Could nayone please help me ..!


Thanks
Arshad
« Last Edit: June 03, 2015, 04:23:06 pm by Arshad8464 »

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Adding Resource For a Element c#
« Reply #1 on: June 03, 2015, 04:22:55 pm »
I'm guessing you need to put something (a role?) in the second pair of quotes.
The Sparx Team
[email protected]

Arshad

  • EA User
  • **
  • Posts: 292
  • Karma: +21/-1
    • View Profile
Re: Adding Resource For a Element c#
« Reply #2 on: June 03, 2015, 04:28:11 pm »
KP thanks Buddy !! Its Working Now..!! ;D ;D ;D ;D ;D


But the error message was really unrelated :(
« Last Edit: June 03, 2015, 04:29:56 pm by Arshad8464 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding Resource For a Element c#
« Reply #3 on: June 03, 2015, 04:51:48 pm »
Quote
But the error message was really unrelated :(

I don't think so. If there is a "not null index" on the role column then this is a totally logical message.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Adding Resource For a Element c#
« Reply #4 on: June 03, 2015, 06:42:57 pm »
It could have been translated to something user friendly, though.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Adding Resource For a Element c#
« Reply #5 on: June 03, 2015, 07:30:13 pm »
Quote
It could have been translated to something user friendly, though.

q.
Also true  :)

Geert