2

In my application I have a connection string in the config. This application created using .NET core 2.11 and SQL Server. This is the connection string:

Data Source=servername\instancename, portnumber;Initial Catalog=dbname;Persist Security Info=True;User ID=username;Password=password;

This string causes an error as shown here:

enter image description here

This error happens if I use instance name and port number in the string. If I remove either one, it is working. So, how do I make it work to used both instance name and port number in the connection string?

saf21
  • 814
  • 1
  • 15
  • 32
  • 1
    Have a look here for how to specify the port number: https://stackoverflow.com/a/5294741, I would avoid the space between the comma and the actual number. I'm not sure you can use a port number with an instance. – Robert Harvey Mar 22 '19 at 04:09

1 Answers1

1

Found the answer. Instance name will be use dynamic port, so I cannot use default port number (1433). Need to change the port number to used 1433 instead of the dynamic port.

saf21
  • 814
  • 1
  • 15
  • 32