经典的ASP问题迭代存储过程的结果

时间:2022-11-27 01:41:08

I have a stored procedure that outputs a recordset but when I loop through that recordset it only writes back one item.

我有一个存储过程,它输出一个recordset,但是当我循环遍历该记录集时,它只会回写一个项。

For example if I write:

例如,如果我写:

vbsRS("fldDateSubmitted")&vbsRS("fldSubmittedBy")&vbsRS("fldDiaryEntry")

it will only show the vbsRS("fldDateSubmitted") value like if I write:

它只会显示vbsRS(“flddatesub”)值,比如:

vbsRS("fldSubmittedBy")&vbsRS("fldDiaryEntry")

it will only show the vbsRS("fldSubmittedBy") value.

它只显示vbsRS(“fldSubmittedBy”)的值。

This doesn't make any sense, can anyone shed any light on the matter?

这没有任何意义,谁能解释清楚这件事?

Here is the stored procedure call:

下面是存储过程调用:

With objCMD
  .ActiveConnection = vbsConn
  .CommandType = adCmdStoredProc
  .CommandText = "sp_GetTherapyDiaryEntries"

  ' Stored procedure parameters
  .Parameters.Append .CreateParameter("@WaltonNumber",adInteger, adParamInput)
  .Parameters.Append .CreateParameter("@EpisodeID",adInteger, adParamInput)
  .Parameters.Append .CreateParameter("@TherapyType",adInteger, adParamInput)

  .Parameters("@WaltonNumber") = vbsZhospitalnumber
  .Parameters("@EpisodeID") = vbsZEpisodeID
  .Parameters("@TherapyType") = 2

  set vbsRS = .Execute
End With

1 个解决方案

#1


0  

I have found the answer.

我找到了答案。

The reason this is happening is because I have some datatypes as VARCHAR(MAX), apparently this is a bug. Changing them to VARCHAR(2000) or whatever number solves the issue.

发生这种情况的原因是我有一些数据类型VARCHAR(MAX),显然这是一个bug。将它们更改为VARCHAR(2000)或任何数字都可以解决问题。

#1


0  

I have found the answer.

我找到了答案。

The reason this is happening is because I have some datatypes as VARCHAR(MAX), apparently this is a bug. Changing them to VARCHAR(2000) or whatever number solves the issue.

发生这种情况的原因是我有一些数据类型VARCHAR(MAX),显然这是一个bug。将它们更改为VARCHAR(2000)或任何数字都可以解决问题。