tags:

views:

27

answers:

2

Hey folks,

I was just trying out working on a WPF app along with Linq To Sql. It seems that the data in my sql server express database is being erased as I close my application. How can I persist these data updates that I do in my application. Here is my connection string, I am sure that needs to be changed, the mdf file is within a folder named DAL in my project.

<connectionStrings>
    <add name="EBS.Properties.Settings.EBSConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\DAL\EBS.mdf;Integrated Security=True;User Instance=True"
        providerName="System.Data.SqlClient" />
</connectionStrings>

Any help appreciated.

A: 

Are you using transactions and then forgetting to flush/commit them, and they get rolled back?

Preet Sangha
Nope, no transactions. Just simple insert delete queries using stored procedure. I read somewhere that, once I compile my project all data gets erased if the mdf file is directly within the project. Not sure if that is correct.
theraneman
+1  A: 

Sorry guys,

Actually updates which are made at runtime are never persisted if working on a local database within the project. The database is copied in the bin folder and used from there as the application restarts. That is why I was not able to see my changes in the database. Arghh!!

theraneman