R
Russell Smallwood
All,
I am writing an ASP.Net wrapper (C#) for a stored procedure library
loosely disguised as an API that uses #mytemptable style tables in the
tempdb to store stuff for a while, until another procedure is called
that uses, then disposes of the #mytemptable table.
This all works great in Query Analyzer but when I call all this stuff
from my ASP.Net code, the temp table dissapears when the datareader I'm
using to create it gets destroyed (there are several steps in each
batch, create the temp table, add some stuff to it, then execute a
function against it, and my temp table is getting destroyed after
step1).
I think I remember reading somewhere that the user temp tables
(#mytemptable) have a pretty limited lifespan. My guess is that they
die when the connection dies, however, they are disapearing when the
SQLDataReader gets detroyed which happens before I close my connection.
As you can see, I'm a bit turned around here, but the bottom line is
that the #mytemptable needs to persist after I've closed or re-assigned
the datareader, as other methods in my class rely on it being there (the
temp table) in order to do their thing.
I can't really change the stored procs so I'm wondering if I can overide
the destructor for the data adapter or something to try and keep it from
covering up its tracks.
I'm worried that I'm going to have to send the whole batch (creation of
the temp table, population of the temp table and execution of the
function against the temp table) over in a stringbuilder nightmare so
the entire batch can execute in one session / connection.
Any help? Clarifications?
-R
--
Russell Smallwood
Relatia Software Corporation
Finally! Time and Billing in GoldMine
www.relatia.net
I am writing an ASP.Net wrapper (C#) for a stored procedure library
loosely disguised as an API that uses #mytemptable style tables in the
tempdb to store stuff for a while, until another procedure is called
that uses, then disposes of the #mytemptable table.
This all works great in Query Analyzer but when I call all this stuff
from my ASP.Net code, the temp table dissapears when the datareader I'm
using to create it gets destroyed (there are several steps in each
batch, create the temp table, add some stuff to it, then execute a
function against it, and my temp table is getting destroyed after
step1).
I think I remember reading somewhere that the user temp tables
(#mytemptable) have a pretty limited lifespan. My guess is that they
die when the connection dies, however, they are disapearing when the
SQLDataReader gets detroyed which happens before I close my connection.
As you can see, I'm a bit turned around here, but the bottom line is
that the #mytemptable needs to persist after I've closed or re-assigned
the datareader, as other methods in my class rely on it being there (the
temp table) in order to do their thing.
I can't really change the stored procs so I'm wondering if I can overide
the destructor for the data adapter or something to try and keep it from
covering up its tracks.
I'm worried that I'm going to have to send the whole batch (creation of
the temp table, population of the temp table and execution of the
function against the temp table) over in a stringbuilder nightmare so
the entire batch can execute in one session / connection.
Any help? Clarifications?
-R
--
Russell Smallwood
Relatia Software Corporation
Finally! Time and Billing in GoldMine
www.relatia.net