How to add new object DataContext ?
-
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
-
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
If they've been persisted, query them back.
-
If they've been persisted, query them back.
-
I impliment the InsertCustomer method - the code :
void InsertCustomer(Customer instance) { this.ExecuteDynamicInsert( instance ); }
And still nothing saved in the DB file.That's not what you said in the original post.
-
I impliment the InsertCustomer method - the code :
void InsertCustomer(Customer instance) { this.ExecuteDynamicInsert( instance ); }
And still nothing saved in the DB file.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
-
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
-
Sorry ... i did not said that dataContext is define in the code below public partial class dataContext : System.Data.Linq.DataContext { .... }
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
-
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
-
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.
And therein lies the problem, trying copy and paste code you don't understand.
I know the language. I've read a book. - _Madmatt