C#调用存储过程中返回的游标怎么读取和保存到变量中
C#调用存储过程中返回的游标怎么读取和保存到变量中
------解决方案--------------------可以利用虚表啊 把游标里的记录放到虚表中
Create Table #NewTable
(newID int,name varchar(50))
Declare My_Cursor Cursor FOR Select ClassID,Name From CA_Global_Class where ChannelID =@ChannelID order by Sortorder
open My_Cursor
Fetch Next From My_Cursor
into @SaveClassID,@SaveName
insert into #NewTable(newiD)
select @SaveClassID,SaveName
while @@FECth_Status =0
begin
Fetch Next From My_Cursor
into @SaveClassID
insert into #NewTable(newiD)
select @SaveClassID,SaveName
end
Select * From #NewTable