Keith Barrows
Keith Barrows

Reputation: 25308

LINQ EF not saving to database

I guess this is a continuation of the last question I asked: bulk insert and update with ADO.NET Entity Framework.

I am not getting any errors while doing inserts yet no data is actually going into my DB. My DB is a SDF file (SQL CE). Any ideas what to check?

My app.config looks like:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
  </configSections>
  <connectionStrings>
    <add name="Lab_Use_Billing.Properties.Settings.LabUseConnectionString" 
         connectionString="Data Source=|DataDirectory|\Models\LabUse.sdf" 
         providerName="Microsoft.SqlServerCe.Client.3.5" />
    <add name="LabUseEntities" 
         connectionString="metadata=res://*/Models.LabUseEntities.csdl|res://*/Models.LabUseEntities.ssdl|res://*/Models.LabUseEntities.msl;
                           provider=System.Data.SqlServerCe.3.5;
                           provider connection string=&quot;Data Source=|DataDirectory|\Models\LabUse.sdf&quot;" 
         providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

TIA

Upvotes: 2

Views: 1455

Answers (2)

DShultz
DShultz

Reputation: 4541

Can you post the code you are using to create the rows in the database?

I assume you're newing up an object context and then using something like:

        myContext.AddToWidgetSet(widget);
        myContext.SaveChanges();

Upvotes: 1

Mike
Mike

Reputation: 1492

Let me guess, your DB is a local database on your computer? Try looking in the project debug folder for a database and see if that has your changes...

Just add the debug database as a new connection in the server explorer and refresh to see if the changes are there...

Upvotes: 5

Related Questions