0

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:

How to run desktop application using SQL Server database on other computer connected with LAN

Also in 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:

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

And the following:

Faulting application name: Factory App.exe, version: 1.0.0.0, time stamp: 0x5bdb0efa Faulting module name: KERNELBASE.dll, version: 10.0.17134.319, time stamp: 0x5ea0e53d Exception code: 0xe0434352 Fault offset: 0x001117d2

2
  • Do the other computers have access to your SQL Server? Commented Oct 31, 2018 at 15:10
  • @PaulKaram i am checking that Commented Oct 31, 2018 at 15:17

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

how ican chagne datasource if i am copy the exe to other pcs ?
@MikeDarwish It will be somewhere in your source code - ideally in an separate file from the application .exe e.g. App.config
on App.config i found the following connectionString="Data Source=DESKTOP-QO2VUSP\SQLEXPRESS;Initial Catalog=AJFactory;Integrated Security=True"
I take care of all your points, maybe we missing something – Mike Darwish 3 hours ago
0

Be aware of security type in the connection string you have:

Integrated Security=True

works only if the two computers are in the same domain. I advise you to add UserName and Password for SQL in connectionString

Comments

0

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:

What is the difference between Integrated Security = True and Integrated Security = SSPI?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.