Click here to Skip to main content
13,052,494 members (68,658 online)
Rate this:
Please Sign up or sign in to vote.
I have developed a simple WPF application in visual studio 2010.

Then i created it's setup. Steps to build setup are as follow:
1)Created a new project for deployment(Named Setup1).
2)Then i copied all files from the Bin folder of my WPF application and Pasted all files in Application Folder of deployment project.
3)Build Setup1.
4)Then i install the Setup1.msi (That was in Bin folder of Setup1 deployment project).
After installation of Setup1.

1)I can retreive the database from database.
2)But it generate exception Exception:Failde to update the database "database name" because database is read only. When i try to insert data into the database.
My connection string is:
string connectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory().ToString()+
@"\tryDatabase.mdf;Integrated Security=True;User Instance=True";

How can i solve this problem?
Posted 15-Sep-12 2:38am
Updated 15-Sep-12 2:40am
Kenneth Haugland 15-Sep-12 8:40am
Did it work in debug?
footballpardeep 15-Sep-12 8:42am
Yes it is working correctly in visual studio correctly.
Wes Aday 15-Sep-12 8:59am
I know, obvious, but have you considered making the database not read only?
footballpardeep 15-Sep-12 9:09am
I don't know the steps you are talking about.
I followed these steps to create database in VS 2010:
1)Project->Add New Item->Service Base Database> Next ->Next...Finish.

2)I also check the permissions of the database by right clicking on the database,they are fine.
footballpardeep 15-Sep-12 10:06am
Problem partially solved:
It's working when i install my software in other drive which don't have window installed.
Please tell me , how will it work if i want to install it in c: drive.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 15 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100