Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return recordset from a temporary table

Status
Not open for further replies.

Pipe2Path

Programmer
Aug 28, 2001
60
Hello,

I've got a stored proc that inserts into a temp table, and returns a recordset. This works fine when I run it in SQL Analyzer, but when a function in VB6 tries to access the recordset just returned, I get an "Operation is not allowed when the object is closed" error. This happens if I try to access the contents of the recordset.

Question: Is it possible to return an open recordset from a temp table?

Any other ideas on how I could accomplish the same thing?

Thx

Kevin


STORED PROCEDURE CODE SNIPPET :

while @@fetch_status = 0
begin
if datediff(day, @MachineFNGWrnty, getdate()) <= 90
begin
select @UnderWarranty = 1
insert into AcctFNGWarranty
values (@MachineSerial,
@MachineModel,
@MachineFNGWrnty,
@UnderWarranty)
end

fetch next from cMachines into @MachineSerial, @MachineModel, @MachineFNGWrnty

end

close cMachines
deallocate cMachines

select * from AcctFNGWarranty


 
I've had the same problem in VB. To resolve this, I modified my stored procedure so that the first line is...

SET NOCOUNT ON

Ex...

Code:
Create Procedure GetMyData
AS
SET NOCOUNT ON

Select All from Everything


-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
No, no, no. Just 'been there, done that'.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top