89373

How to make wpf apps on same netwrok read data from one SQL Server?

Question:

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>

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:

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

</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:

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

Answer3:

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>

Recommend

  • Elmah not logging 404 (missing files / images)
  • Login failed for user ''
  • Can I disable IE compatibility mode only for content within a ?
  • How can I create a plugin mechanism that calls functions only when the plugin is available?
  • Android onKey w/ virtual keyboard
  • HttpListener.IsSupported is false on XP SP3
  • Sensibility of combined Maven/Ant+Ivy build management for dual platform Desktop/Android deployment?
  • Error in installing package: fatal error: stdlib.h: no such file or directory
  • How to make R's read_csv2() recognise the text characters properly
  • Enabling DTD support in Sql Server
  • GAE: Way to get reference to an HttpSession from its ID?
  • Does Mobilefirst provide a provision to access web services directly?
  • MS Access - How to change the linked table path by amend the table
  • How to revert to previous XCode version?
  • Detect when Facebook like button is clicked
  • AJAX Html Editor Extender upload image appearing blank
  • d3 v4 drag and drop with TypeScript
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • JQuery Internet Explorer and ajaxstop
  • Deselecting radio buttons while keeping the View Model in synch
  • Nant, Vault & Windows Integrated Authentication
  • C# - Serializing and deserializing static member
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Window Size for Mac application
  • Sending data from AppleScript to FileMaker records
  • Where to put my custom functions in Wordpress?
  • WOWZA + RTMP + HTML5 Playback?
  • Numpy divide by zero. Why?
  • How to include full .NET prerequisite for Wix Burn installer
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • Linking SubReports Without LinkChild/LinkMaster
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Is it possible to post an object from jquery to bottle.py?
  • sending mail using smtp is too slow
  • Is there any way to bind data to data.frame by some index?
  • Busy indicator not showing up in wpf window [duplicate]
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • How can i traverse a binary tree from right to left in java?
  • How can I use `wmic` in a Windows PE script?