Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server erDirection]“输入”; $result=$SqlCmd1.ExecuteNonQuery() 写入“result=$result” $SqlConnection1.Close() $SQLCmd1.Dispose()| Out Null }_Sql Server_Powershell - Fatal编程技术网

Sql server erDirection]“输入”; $result=$SqlCmd1.ExecuteNonQuery() 写入“result=$result” $SqlConnection1.Close() $SQLCmd1.Dispose()| Out Null }

Sql server erDirection]“输入”; $result=$SqlCmd1.ExecuteNonQuery() 写入“result=$result” $SqlConnection1.Close() $SQLCmd1.Dispose()| Out Null },sql-server,powershell,Sql Server,Powershell,我正在调用函数将内部镜像到函数getInsertServerStatus。 连接字符串到函数(镜像)连接错误,因为未找到$server和$instance名称。您的代码中有一些错误: 首先,在函数getInsertServerStatusyou中调用mirroring,而不传递参数$svr$inst。。。。 应该是: mirroring $svr1 $inst1 ... other parameters second, Inside the function **mirroring

我正在调用函数
内部镜像到函数
getInsertServerStatus

连接字符串到函数(
镜像
)连接错误,因为未找到
$server
$instance
名称。

您的代码中有一些错误:

首先,在函数getInsertServerStatusyou中调用mirroring,而不传递参数$svr$inst。。。。 应该是:

   mirroring  $svr1  $inst1  ... other parameters

second, Inside the function **mirroring** you call **GetConnectionString** 
    GetConnectionString $svr  $inst
不传递参数$servers$instance 应该是:

   mirroring  $svr1  $inst1  ... other parameters

second, Inside the function **mirroring** you call **GetConnectionString** 
    GetConnectionString $svr  $inst
在主程序中调用GetConnectionString$servers$instance,并且不将返回值传递给变量,并且在代码中没有任何效果,请删除此行


用建议的代码修改您的代码。

试着制定一个解决方案。这个问题包含许多不必要的代码。删除任何与问题无关的内容可能会显示出问题的部分。也包括实际的错误消息。假设有什么问题?函数中存在连接字符串错误(镜像)并且不知道原因?我们也不知道,因为您仍然认为没有必要实际显示错误消息。