我有字符串数组GTIDArr
让我们说GTID={"CODE1","CODE2","CODE3"}
我想从具有上述 GTID 的以下查询的数据库中获取记录。
因此我做了以下事情:
Dim sqlTransferExcel As String = " select gt.GTID ,gt.TransferDate ,pl.LocationName as FromLocation,Pto.LocationName as ToLocation,gt.TransferedMode ,gt.TransferedDetails ,gt.Remarks ,p.ProductName+case when c.CategoryName IS null then '' else '-'+c.CategoryName end as PName,gd.QtyTransferred " _
& " from dbo.GoodTransferDetails gd Left outer join ProductMaster p on gd.ProductID =p.ProductID " _
& " Left Outer join CategoryMaster c on gd.CategoryID =c.CategoryID " _
& " Left Outer join dbo.GoodTransfer gt on gt.GTID=gd.GTID " _
& " Left Outer join PescaLocation pl on gt.FromPescaLocation =pl.PLID " _
& " Left Outer join PescaLocation Pto on gt.ToPescaLocation =pto.PLID " _
& " where gd.GTID in ( '" & GTIDArr() & "' ) order by p.OrderID "
但它给了我最后一行在 where 条件下的错误
错误 101 索引数小于索引的维数
我怎样才能在这个查询中有字符串数组?