I have a C# WPF app running inside Visual Studio 2017 on my computer and I am using SQL Server 2014 to save/select data.
How can I run it on another Windows computer on the same network without installing Visual Studio / SQL Server? This app should read/insert data from/in my SQL Server.
I tried to using publish option, but the app isn't able to read data from my computer on other network pcs.
Also, I tried to copy bin to other pcs, but the app still isn't able to read data from SQL Server.
I already prepare SQL Server to receive a connection using the following steps on the following link:
<a href="https://stackoverflow.com/questions/22715440/how-to-run-desktop-application-using-sql-server-database-on-other-computer-conne" rel="nofollow">How to run desktop application using SQL Server database on other computer connected with LAN</a>
app.config, I found the following connection string:
connectionString="Data Source=DESKTOP-QO2VUSP\SQLEXPRESS;Initial Catalog=AJFactory;Integrated Security=True"
I Checked the Event handler from other pcs, I find the following Errors:<blockquote>
Application: Factory App.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Data.SqlClient.SqlException at System.Data.SqlClient.SqlInternalConnectionTds..ctor(System.Data.ProviderBase.DbConnectionPoolIdentity, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SqlCredential, System.Object, System.String, System.Security.SecureString, Boolean, System.Data.SqlClient.SqlConnectionString, System.Data.SqlClient.SessionData, System.Data.ProviderBase.DbConnectionPool, System.String, Boolean, System.Data.SqlClient.SqlAuthenticationProviderManager</blockquote>
And the following:<blockquote>
Faulting application name: Factory App.exe, version: 18.104.22.168, time stamp: 0x5bdb0efa Faulting module name: KERNELBASE.dll, version: 10.0.17134.319, time stamp: 0x5ea0e53d Exception code: 0xe0434352 Fault offset: 0x001117d2</blockquote> Answer1:
The fact that it's a WPF application is irrelevant.
You need to change the connection string for your SqlConnection object. It will probably say something like "Data Source=Localhost" or "Data Source=127.0.0.1". This should be changed to the network name of your PC.
You will also need to check your Sql Server / Database configuration that another user has the correct access rights that this application needs.Answer2:
Be aware of security type in the connection string you have:
works only if the two computers are in the same domain. I advise you to add UserName and Password for SQL in connectionStringAnswer3:
You need to set
Integrated Security=False then When it false,you need to specified the
User ID and
Password in the connections string, For more info about Integrated Security, Check the following Answer:
<a href="https://stackoverflow.com/questions/1229691/what-is-the-difference-between-integrated-security-true-and-integrated-securit" rel="nofollow">What is the difference between Integrated Security = True and Integrated Security = SSPI?</a>