Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to add new object DataContext ?

How to add new object DataContext ?

Scheduled Pinned Locked Moved Database
databasedebuggingtutorialquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Im using the object DataContext to save some object to DB. I see that the object presistence is Ok - but after i stop the debug and i recompile it - i dont see the object anymore. The saving action that i did: dataContext.table.InsertOnSubmit( someObject); dataContext.SubmitChanges();

    modified on Sunday, December 5, 2010 7:56 AM

    P 1 Reply Last reply
    0
    • L Lost User

      Im using the object DataContext to save some object to DB. I see that the object presistence is Ok - but after i stop the debug and i recompile it - i dont see the object anymore. The saving action that i did: dataContext.table.InsertOnSubmit( someObject); dataContext.SubmitChanges();

      modified on Sunday, December 5, 2010 7:56 AM

      P Online
      P Online
      PIEBALDconsult
      wrote on last edited by
      #2

      If they've been persisted, query them back.

      L 1 Reply Last reply
      0
      • P PIEBALDconsult

        If they've been persisted, query them back.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        I impliment the InsertCustomer method - the code : void InsertCustomer(Customer instance) { this.ExecuteDynamicInsert( instance ); } And still nothing saved in the DB file.

        P N 2 Replies Last reply
        0
        • L Lost User

          I impliment the InsertCustomer method - the code : void InsertCustomer(Customer instance) { this.ExecuteDynamicInsert( instance ); } And still nothing saved in the DB file.

          P Online
          P Online
          PIEBALDconsult
          wrote on last edited by
          #4

          That's not what you said in the original post.

          1 Reply Last reply
          0
          • L Lost User

            I impliment the InsertCustomer method - the code : void InsertCustomer(Customer instance) { this.ExecuteDynamicInsert( instance ); } And still nothing saved in the DB file.

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Have you read the documentation? http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executedynamicinsert.aspx[^] "It is not intended to be called as a stand-alone operation outside the scope of a SubmitChanges operation." Why are you subclassing DataContext?


            I know the language. I've read a book. - _Madmatt

            L 1 Reply Last reply
            0
            • N Not Active

              Have you read the documentation? http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.executedynamicinsert.aspx[^] "It is not intended to be called as a stand-alone operation outside the scope of a SubmitChanges operation." Why are you subclassing DataContext?


              I know the language. I've read a book. - _Madmatt

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Sorry ... i did not said that dataContext is define in the code below public partial class dataContext : System.Data.Linq.DataContext { .... }

              N 1 Reply Last reply
              0
              • L Lost User

                Sorry ... i did not said that dataContext is define in the code below public partial class dataContext : System.Data.Linq.DataContext { .... }

                N Offline
                N Offline
                Not Active
                wrote on last edited by
                #7

                Yes, of course you are subclassing DataContext. I understood that. Would like to answer the question now?


                I know the language. I've read a book. - _Madmatt

                L 1 Reply Last reply
                0
                • N Not Active

                  Yes, of course you are subclassing DataContext. I understood that. Would like to answer the question now?


                  I know the language. I've read a book. - _Madmatt

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  I dont know the other way. I saw in all the code example that i need create subclassing Datacontext and with this subclassing to call the InsertAllOnSubmit and SubmitChanges method. Please tell me where i wrong.

                  N 1 Reply Last reply
                  0
                  • L Lost User

                    I dont know the other way. I saw in all the code example that i need create subclassing Datacontext and with this subclassing to call the InsertAllOnSubmit and SubmitChanges method. Please tell me where i wrong.

                    N Offline
                    N Offline
                    Not Active
                    wrote on last edited by
                    #9

                    And therein lies the problem, trying copy and paste code you don't understand.


                    I know the language. I've read a book. - _Madmatt

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups