How to connect to SQL Server Express on local network via UWP app

Preveen 216 Reputation points
2020-07-05T22:02:57.997+00:00

Hi,
How do I connect my UWP app (running on a laptop, connected to the same network) to a different PC running SQL Server 2019 Express?

My app on the laptop needs to get data from a database hosted on SQL Server 2019 Express on my PC.
When I try to connect to the PC via the app on the laptop (I have a window to test the connection), I get an error.

Here's the connection string:
`
string connString = $"Data Source={serverName}\{instanceName}; Initial Catalog={databaseName}; Integrated Security=SSPI";

`

serverName, instanceName and databaseName are variables that the user types in to the TextBoxes on the test connection window.

I have allowed remote connection to my database using SQL Server Configuration Manager: TCP/IP is set to Enabled

Any help is appreciated.

P.S.: The database is set up using Windows Authentication (if that info is relevant), but Mixed mode can also be used if it means that the app can work with the db on the server PC.

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 additional answer

Sort by: Most helpful
  1. KalyanChanumolu-MSFT 8,316 Reputation points
    2020-07-06T03:59:15.047+00:00

    Please check if you are using the FQDN for ServerName in the connection string.

    To get the FQDN, press and hold the Windows key, then press the Pause/Break key

    Use the Full Computer Name

    86554244-b017a680-bf6a-11ea-99cd-ac139035427c.png

    0 comments No comments