# Stored Procedure传回Resultset..

Posted by Sandra on September 25, 1997 at 10:19:31:

您好!!
想请教使用vb6 RDO + SQL Server's Stored Procedure的问题,
不知道如何开启Stored Procedure传回来的Resultset...

[Stored Procedure程式码]
Create PROCEDURE point1
@mem_no varchar(10)
AS
Select member_no,left_brother,right_brother from member
where member_no=@mem_no
return (0)
GO

[VB程式码]
Set Ev1=rdoEnviroments(0)
Ev1.CursorDriver=rdUseClientBatch
'^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'如果把这一行去掉会出现:==>
'Cannot Open a cursor on a stored procedure that has
'anything other than a single select statement in it.
Set Cn1=Ev1.OpenConnection("",rdDriveNoPrompt,False,pswd)
Set Query1=Cn1.CreateQuery("","{call point1(?)}")
Query1(0)=txtQmemberNo.Text
Set Rs1=Query1.OpenResultset(rdOpenForwardOnly,rdCursorReadOnly)

Debug.Pring "Rs1.RowCount=" & Rs1.RowCount
txtLeftBrother.Caption=Rs1("left_brother")
txtRightBrother.Caption=Rs1("right_brother")

这样结果是可以出来了(txtLeftBrother.caption和txtRightBrother.Caption有内容)
可是印出来的 RowCount 都是=-1 ;
我想把结果输出到MSFlexGrid上, 所以必须知道共传回几笔资料..
而且就算有传回资料, RowCount也是=-1 而不是1.
无法判断是否传回资料.

不知程式那里有错 为何出现这种状况..

Follow Ups: