Click here to Skip to main content
15,916,215 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have a windows application and ms sql server database with it.I want to deploy the application along with the database to client using single .exe file.How will I do it ??
If I use clickonce method what should be connection string when I deploy the application.how do I determine what connection string to mentioned.Is there any other method for deploying windows application with database.

What I have tried:

C#
I have tried clickonce method but connection to database doesnot work.I think the issue is with connection string.I am using the below connection string which I use on my development machine.<pre lang="c#"><add name="Constr" connectionString="Data Source=.;AttachDbFilename=D:\SApplication\Database1.mdf;Integrated Security=True" providerName="System.Data.SqlClient" /></pre>
Posted
Comments
[no name] 27-Oct-16 6:56am    
Yes I would agree that your connection string is probably part of the problem. You don't know that the user has a D drive much less that you know that they are going to install your database in "D:\SApplication"

And, this a repost. You have already been told what to do.
Roy1209 27-Oct-16 7:23am    
So how should I tackle the issue ??
[no name] 27-Oct-16 8:29am    
Personally, I would go and do what you have already been told to do. Repeating the same information doesn't do any good.

1 solution

Your connection problem is because your connection string is for YOUR machine, not your customer's. He probably doesn't even have a D drive. Your app should have a specific application subfolder in which the database resides, and then you need to build your connection string according to the installed location for the app.
 
Share this answer
 
v4
Comments
Roy1209 28-Oct-16 4:32am    
Can you provide an example connection string for client machine ?? When I install the application how will I mention where the application should get installed when using clickonce method

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