Willy Esteban said:
How do I configure a SQLDataAdapter to use the results of a temporary table
from a stored procedure?
I also want to produce a strongly typed dataset from the SQLDataAdapter.
The VS wizard states "Invalid object name '#MyTempTable'" The table mappings
is empty.
VS has only a limited ability to retrieve tabular metadata from stored
procedures, and as you have discovered, temp tables are beyond those limits.
You should have a dummy table or view in your database which has the same
structure as your temp table. In essence this "publishes" the temp table
metadata to the world and lets you easily build strongly-typed datasets from
it.
In SQL2k , if you change your SP to a table-valued user-defined function,
and then wrap the UDF in a view, and perhaps also in a stored procedure,
then you won't have to keep your dummy table up to date. It will all be
driven off the UDF.
like
create function dbo.MytableValuedFunction(@i int, @a varchar)
....
create view v_MyTableValuedFunction
as
select * from dbo.MyTableValuedFunction(null,null)
David