Sql-server – I cannot write into SQL Server 2008 R2 express edition from C#

sql-server-2008-r2

There is no error, the dataset is getting updated, but the database is not updated.

I am using Windows authentication in connection string to the database. I have given accept changes on update.

Best Answer

Are you using the User Instances and AttachDbFileName options in your connection string? If so I will bet that you are actually connected to two different copies of your database. You need to make sure you are connecting to the same copy - I would suggest manually attaching the database on your Express instance, and always connecting to that without the use of User Instances and AttachDbFileName.

If this is not the case, please show the connection string you are using in C# and how you are validating that the data is not updated (e.g. you are probably using a different application and/or connection string for that).

The User Instances feature is actually deprecated for future development work. In SQL Server 2012 this is replaced with SqlLocalDb.