SQL Network Interfaces, error: 25 - Connection string is not valid in Powershell

后端 未结 6 622
天命终不由人
天命终不由人 2021-01-12 10:36
$SQLconnection = New-Object System.Data.SqlClient.SqlConnection
$SQLconnection.ConnectionString = \"Server = MySQLservername\\MSSQLSERVER; Database = \"MYSQLDB\"; In         


        
6条回答
  •  失恋的感觉
    2021-01-12 11:22

    If your database/instance is provided on a port number, I got the error 25 when I didn't set up the connection string correctly.

    $SQLconnection.ConnectionString = "Server = MySQLservername.domain.ext\InstanceName, PORT; Database = `"MYSQLDB`"; Integrated Security = True"
    

    For example:

    $SQLconnection.ConnectionString = "Server = SQL01v.fordco.prd\DBSYS, 1433; Database = CarsDB; Integrated Security = True"
    

提交回复
热议问题