Databases in App_Data do not save data

I have a sql database in my app_data folder and my connection string looks like this:

Server=.\SQLExpress;AttachDbFilename=|DataDirectory|wikipediamaze.mdf; Trusted_Connection=Yes;

I am using Fluent Nhibernate and everything displays correctly. I can connect to the database just fine and even update and insert rows with no problem.

My problem is that after I stop debugging, none of my data exists. I checked to put my database in bin folder and create a new instance for every application run, but this is not the case.

Does anyone have any other suggestions? I spent 2 nights trying to figure this out.

Thanks!

0


a source to share


2 answers


The problem I ran into was that I was using the NHibernate session incorrectly. I needed to call ISession.Flush or ITransaction.Commit to save it to the database.



0


a source


One possibility is that you are not making changes. Run SQL Profiler and you will see what exactly SQL is running on your database.



0


a source







All Articles