views:

338

answers:

2

I am using a Domain Service Class linked to a Linq-to-Sql Context. Using breakpoints it successfully Adds,

context.Company.Add(NewCompany);

Am calling this from Silverlight,but the saving part seems to fail...

context.SubmitChanges();

As in, I get no errors, nor does it add to the database. All my tables have a relation to each other like "Company" has a relation with "Address", did I miss a step?

A: 

In case you're using a file database (mdf, sdf, mdb...) :

Check in the properties of your database project item that the "Copy to output directory" property is set to "Do not copy" or "Copy if newer". Otherwise, the database file in the output directory will be overwritten every time you compile. That's pretty dumb, but it's the default behaviour in VS...

Thomas Levesque
Actually I found the answer and its similar to you suggestion, I checked the error called after submitting and apparently my connection string was wrong. It was login in with wrong credentials..
Fredrick
A: 

I finally found the error... apparently my Connection String was wrong, it was trying to connect with out my credentials.. When Linq-To-Sql object was created it didnt save the credentials... gosh what a waste to a weekend...

Fredrick