Click here to Skip to main content
15,922,155 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,i have a app and i used local db and ado.net(EF6),automatically my connection in App.config changed when i used Ado.net(EF6),Everything is fine and worked correctly,and i test my app in release and debug folder,that's worked fine and even i used my debug folder on another windows(SQL server was installed on this windows) and worked fine,but my problem is here why when i publishing my app and installing my app on another windows(SQL server was installed on this windows)my App don't run and that's not about runtime and like this.
That's my connection string:
<connectionStrings>  
  <add name="GymDbV2Entities" connectionString="metadata=res://*/Models.Model1.csdl|res://*/Models.Model1.ssdl|res://*/Models.Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=(LocalDB)\MSSQLLocalDB;attachdbfilename=|DataDirectory|\Data\GymDbV2.mdf;Initial Catalog=GymDbV2;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>

Thank You guys for reading and your Time <3

What I have tried:

i tried assemble and publish my app with "Advanced Installer" App but that's not worked again,i give to my database file full control for everyone and that's not about my DB security too
Posted
Updated 22-Apr-23 13:25pm
Comments
[no name] 22-Apr-23 14:58pm    
I don't see where you actually confirm that your database is where you think it is; e.g. "DataDirectory", etc.
Max Speed 2022 22-Apr-23 19:31pm    
i made a folder on root of my project with this name "Data" and my local db is in this folder,my local db name is "GymDbV2.mdf"
George Swan 23-Apr-23 1:38am    
This is my go to reference for SQL Server connection problems
https://social.technet.microsoft.com/wiki/contents/articles/2102.sql-server-troubleshooting-database-engine-connection-issues.aspx

1 solution

Download SQL Server Management Studio (SSMS) - SQL Server Management Studio (SSMS) | Microsoft Learn[^] onto the machine that has the issue and try to connect to your database.

This is one step in the process of elimination. If you can connect using the above connection string, then you know the issue is with your app. If not, then you need to identify the connection string that you need to use.
 
Share this answer
 

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