Click here to Skip to main content
15,888,062 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Project with Database in it,
This is my app.config's code.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="QuanLyDoiBong"
            connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\QuanLyBongDa2.mdf;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

I Deploy a project using install shield limited edition, if I install it on my PC it works perfectly, If I bring it to another PC (don't have SQL sever), whenever I press some button that need to connect to database I got this exception:

a network-related or instance-specific error occurred while establishing a connection to sql server, The sever was not found or was not accessible. Verify that the instance name is correct and that SQL sever is configured to allow remote connections. (Provider: SQL network intefaces, error 52 - Unable to locate a Local Database runtime installation. Verify that SQL sever Express is Properly installed and that the Local Database runtime feature is enabled
.

I think that my "Order PC (Which don't have SQLsever installed)" need to install SQLSever if so how can I run this application on Other PC without install SQL-sever ?
and .. English isn't my mother tongue language, so ... Sorry for any mistake I made..
Posted
Updated 5-Jun-14 20:58pm
v2

1) In setup properties you will find one opiton that is Prerequisite select all Prerequisite from there like sqlserver and ...
2)when you creating setup add primary output and "content file" that will automatically add all file and folder from your project it will have database also

These picture will help you to understand more..

Creating an MSI Package for C# Windows Application Using a Visual Studio Setup Project[^]


Accept it if its work for you
 
Share this answer
 
that my "Order PC ... need to install SQLSever

Yes, if you really want to use LocalDB, otherwise SQL Server doesn't have to be installed on that system, but the system needs to be able to communicate with some system that has SQL Server with the database attached. If this software is for someone else, then allow them to provide the SQL Server instance (a client may already have SQL Server installed), attach the database, and edit the config file as they need.
 
Share this answer
 
Comments
Pravuprasad 6-Jun-14 2:59am    
this one is the perfect suggestion for your problem .

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