This has been annoying me for two days now. I\'m updating an old ordering int
I think you causing yourself more issues by trying anything and everything. With each attempt you make slight mistakes in your syntax (like quotes in the wrong place, not specifying a CommandType
etc).
If it helps this is how I would code for that stored procedure
Dim cmd, rs, sql
Dim data, rows, row
Set cmd = Server.CreateObject("ADODB.Command")
'Name of your stored procedure
sql = "dbo.sp_PalletSearch"
With cmd
.ActiveConnection = cConn 'Assuming cConn is a connection string variable
.CommandType = adCmdStoredProc
.CommandText = sql
'Define Stored Procedure parameters
Call .Parameters.Append(.CreateParameter("@CustomerRef", adInteger, adParamInput, 4))
Call .Parameters.Append(.CreateParameter("@SearchQuery", adVarChar, adParamInput, 15))
'First parameter is optional so only pass if we have a value, will default to NULL.
If Len(CustomerId) > 0 Then .Parameters("@CustomerRef").Value = CustomerID
.Parameters("@SearchQuery").Value = strSearchQuery
Set rs = .Execute()
'Populate 2D-Array with data from Recordset
If Not rs.EOF Then data = rs.GetRows()
'Close and Release Recordset from memory
Call rs.Close()
Set rs = Nothing
End With
Set cmd = Nothing
If IsArray(data) Then
rows = UBound(data, 2)
For row = 0 To rows
Call Response.Write("Pallet Id: " & data(0, row) & " | Pallet Code: " & data(1, row) & " br>")
Next
End If