Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Community Discussions (All other subjects)
 How to open recordset for this kind of sp?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

GoodMorningSky
Junior Member

122 Posts

Posted - 11 May 2004 :  21:00:56  Show Profile
Hi, all.
I tried to get result of sp.
Dim rst As Recordset
Set rst = New ADODB.Recordset
rst.Open sp, cnn

doesn't get result.
when i call rst.EOF, it thows error: Can do this since rst is closed...

I found it's problem of sp which is little complex.
But, still I think it should work!
My question is how can I get the returned value from following sp in VB?


--- return list of tables that needed to update
--- list is one string separated by '&' delimeter
--- @listOfUpdateTime: [TableName=UpdateTime]&[...]  eg) tblDeptList=12/25/2004&tblHoliday=12/24/2004&...
CREATE procedure spGetListOfTableToDownLoad
	@listOfUpdateTime varchar(500)
as
	SET NOCOUNT ON
	Declare @listOfTable varchar(300), @item varchar(300)
	Declare @tbl varchar(50), @uptime datetime
	Declare @list varchar(500)
	Declare @sep varchar(1)
	SET @list = ''
	SET @sep = '&'
	DECLARE cur CURSOR FAST_FORWARD FOR 
	SELECT * FROM fnSplit(@listOfUpdateTime, @sep)
	
	OPEN cur
	
	FETCH   NEXT
    FROM    cur
    INTO    @item
	
	Declare @re bit, @tp varchar(50)
	WHILE @@FETCH_STATUS  = 0
		BEGIN
			
			-- get tablename, update time
			Declare cur2 CURSOR FAST_FORWARD FOR 
			SELECT * FROM fnSplit(@item, '=')
			OPEN cur2
			FETCH NEXT FROM cur2 INTO @tbl
			Print @tbl
			FETCH NEXT FROM cur2 INTO @tp
			print 'tp:' + @tp
			SET @uptime = CAST(@tp as datetime)
			print @uptime
			-- @re =1: true, 0: false
			EXEC spIsUpdate @tbl, @uptime, @re output
			IF @re = 1 
				SET @list = @list + @tbl + @sep
			CLOSE cur2
			DEALLOCATE cur2

			FETCH   NEXT
		    FROM    cur
		    INTO    @item
		END
		if LEN(@list) > 0 
			SET @list = LEFT(@list, Len(@list)-Len(@sep))
	CLOSE cur
	DEALLOCATE cur

	SELECT @list as Result

	SET NOCOUNT OFF


GO


Software Engineer.
MCSD.NET, SCWCD
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.29 seconds. Powered By: Snitz Forums 2000 Version 3.4.07