作者:2674224139_8a6503 | 来源:互联网 | 2023-06-20 11:32
Ihaveafunctionthatrunsastoredprocedurethatreturnsonlyasinglerowandcolumn(sooneres
I have a function that runs a stored procedure that returns only a single row and column (so one result).
我有一个函数,它运行一个只返回单个行和列的存储过程(所以一个结果)。
I'm trying to get that one result into a variable so I can return it. I'm trying to use recordset.MoveFirst
but I get the "Rowset position cannot be restarted." error. I tried just removing it, since I only have one result, but I then get an overflow. My statement looks like this:
我试图将一个结果变成变量,所以我可以返回它。我正在尝试使用recordset.MoveFirst但我得到“行集位置无法重启”。错误。我试着删除它,因为我只有一个结果,但我得到溢出。我的陈述如下:
If recordset.EOF = False Then
recordset.MoveFirst
temp = rs!ID
End IF
temp
is an integer. I've checked the stored procedure to make sure it only returns the single result, and it does. Am I doing something wrong? Is there a better way to pass the result into a variable? It's possible the recordset is forward only (which means it's read only?) but I can't seem to find an answer as to how to fix that.
temp是一个整数。我检查了存储过程以确保它只返回单个结果,它确实存在。难道我做错了什么?有没有更好的方法将结果传递给变量?记录集可能只是转发(这意味着它是只读的吗?)但我似乎无法找到如何解决这个问题的答案。
3 个解决方案