我正在使用SqlCommandProvider,我需要为id集合中的每个id获取一些数据
let ids=["B058A99-C4B2-4CC3-BA9F-034B1F1ECCBD";"A09C01C-D51B-41C1-B44C-0995DD285088"]
[<Literal>]
let qLogo ="""SELECT Id,LogoUrl FROM Hotels WHERE Id IN (@IDS)"""
let queryLogo = new SqlCommandProvider<qLogo,constring>()
queryLogo .Execute(ids)//i need to be able to pass a collection here
Run Code Online (Sandbox Code Playgroud)
`
我一直在尝试使用以下脚本,但没有成功:
$Ami=Get-EC2ImageByName WINDOWS_2012_BASE
New-EC2Instance -ImageId $Ami[0].ImageId -MinCount 1 -MaxCount 1 -KeyName uckey -InstanceType `
t1.micro -SubnetId subnet-56738b33 -AssociatePublicIp $true
Run Code Online (Sandbox Code Playgroud)
错误是:
New-EC2Instance : Object reference not set to an instance of an object.
At line:1 char:1
+ New-EC2Instance -ImageId $Ami[0].ImageId -MinCount 1 -MaxCount 1 -KeyName uckey ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Amazon.PowerShe...2InstanceCmdlet:NewEC2InstanceCmdlet)
[New-EC2Instance], InvalidOperationException
+ FullyQualifiedErrorId : System.NullReferenceException,Amazon.PowerShell.Cmdlets.EC2.NewEC2InstanceC
mdlet
Run Code Online (Sandbox Code Playgroud)
问题在于-AssociatePublicIp没有它的参数,脚本可以工作。
谢谢阅读