Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
4.00/5 (1 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:
C#
string connectionString = @"Data Source=.\SQLEXPRESS;AttachDbFilename="+Directory.GetCurrentDirectory().ToString()+
@"\tryDatabase.mdf;Integrated Security=True;User Instance=True";


How can i solve this problem?
Posted
Updated 15-Sep-12 2:40am
v2
Comments
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.
[no name] 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900