sql-2000 question

C-Programming , SQL-2000 server remote connection:
this query fails. "spRS->Open" fails. stays closed.
without create #PGames table,,, it works fine.

i=sprintf (buf,"create table #PGames (Name nvarchar(15), DT smalldatetime) \
insert into #PGames \
select Games.Name, Games.DT \
from Games \
where Games.DT >= '10/05/01' \
select #PGames.Name as nm, #PGames.DT as dt \
from #PGames \
order by #PGames.DT asc \
DROP TABLE #PGames");

if (i >= 0){
spRS->Open(buf,
vtMissing, adOpenKeyset,
adLockBatchOptimistic, -1
);}

while(spRS->adoEOF == false){
tmp1 = UC _bstr_t(RsITEM(spRS,"nm"));
tmp2 = UC _bstr_t(RsITEM(spRS,"dt"));
,,,...
}
[754 byte] By [nanos] at [2007-11-18 19:02:26]
# 1 Re: sql-2000 question
Hi
you should create the table as a local variable in a stored proc then call it. It will be dropped automatically.
note that you open a keyset cursor while you have already droped the table .. The data no longer exists.

or you can try not to drop the table in the same step :
Fill data
return data from query to the client
after manipulating data drop the table
also you better use a static or forwardnoly readonly cursor.
hspc at 2007-11-9 13:37:28 >