Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics SL (Archived)

Passing Array Parameter to SQL Store procedure

(0) ShareShare
ReportReport
Posted on by 555

Hi,

      I want to pass an array as a parameter in Code.Have used "SParam(Arrayobject)" but it showing error .How can i send array parameter in vba. herewith have pasted my code 


Private Sub Update1_OnFinish(Level As Integer, Updated As Integer, retval As Integer)

Dim xSQL As String
Dim MarkUp As String
Dim invtid As String
Dim batnbr As String
Dim status As String
Dim qty As Integer
Dim i As Integer

Dim ParamVal(10, 2) As String

If Level = 0 Then
Mem_handle = GetGridHandle("Spread1")
MsgBox mrowcnt(Mem_handle)
If Trim(GetObjectValue("cBatchHandling")) = "R" Then

Dim iretval As Integer
Dim iMaintFlg As Integer

iretval = MFirst(Mem_handle, iMaintFlg)
i = 0
While iretval = 0


invtid = Trim(GetObjectValue("cInvtId"))
batnbr = Trim(GetObjectValue("cBatNbrh"))
MarkUp = Trim(GetObjectValue("xuser11"))
qty = Trim(GetObjectValue("cQty"))

ParamVal(i, 0) = invtid
ParamVal(i, 1) = qty
ParamVal(i, 2) = MarkUp

i = i + 1

iretval = MNext(Mem_handle, iMaintFlg)

Wend

xSQL = "X_Transfers" & SParm(ParamVal) & SParm(batnbr) 
Call sql(X_Transfers, xSQL)
End If

End If

End Sub

my store procedure like :

CREATE TYPE Param_list AS TABLE (
invtid varchar(60),qty varchar(10),MarkUp varchar(10)
);
GO

Create Proc X_Transfers
@Param_list Param_list READONLY,@TransferBatnbr varchar(10)
as

select * from @Param_list 

please genius help me

*This post is locked for comments

  • ThillaiRaja Profile Picture
    555 on at
    RE: Passing Array Parameter to SQL Store procedure

    I am not sure if parameter support array object .so in single variable have added the value as Comma separated and in sql i have split the comma separated values...

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,748 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans