Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: SQL LINQ C#4.0
HI guys,
I am creating an Permission Repository and this code is from my book.
public void SavePermission(Permission permission)
    using(FisharooDataContext dc = Connection.GetContext())
      if(permission.PermissionID > 0)
        <u> dc.Permissions.InsertOnSubmit(permision);</u>
I get error when i use dc.Permissions.Attach(permission,true).. it gives me an error saying it cant take more than 2 arguments.
when is try using
my visual studio's intellisense cannot recognize InsertOnSubmit or SumbmitChanges
maybe i should use an using statment but i dont kno which!
and i even reffered my code to this webpage[^][^]
but i dont find any differences.
Please help me out with my above 3 mentioned problems.
Thank you.
Posted 13-May-12 15:51pm
Edited 13-May-12 18:44pm
SASS_Shooter at 14-May-12 17:21pm
For the InsertOnSubmit and SubmitChanges issues, did you look to see if you have
using System.Data.Linq?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

is this a typo?
I'm sure it is as the code above and on the linked source says so.
I assume that your (Connection)conn.GetContent returns a System.Data.Linq.DataContext instance? If this has been instanciated then why would you need to attach a record to it when the record already exists? Are you using some form of data caching? The way that changes to a specific record would be acheived is to select the record out of the table, update eacha and every property and then just dc.SubmitChanges() (I think :S)
Are you sure that the "Permissions" table has a capital P as automatically generated dbml files usually put this to lower case, as with the entity type "permission"
If I have all of this wrong then please post the proof in code as there may be a small error there you have missed.
Hope this is useful Wink | ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 350
1 Jochen Arndt 150
2 Richard MacCutchan 135
3 PIEBALDconsult 110
4 Sergey Alexandrovich Kryukov 104
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294

Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 16 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100