dear Mr tlbroadbent,
I encounter a problem with SQL-Server in ASP, and I need your helps. I had written a ASP page, something like that:
<%
dim cmd
dim rs
dim rs2
dim rst
dim dbconnect
Set dbConnect = Server.CreateObject("ADODB.Connection"

strConnect = "Provider=SQLOLEDB.1; Data Source=SERVER; User ID=sa; PWD=; Initial Catalog=fare_search"
dbConnect.ConnectionTimeout = 40
dbConnect.open strConnect
Set cmd=Server.CreateObject("ADODB.Command"

cmd.ActiveConnection = dbConnect
cmd.CommandText = "create table #temptable (aircode char(2),fromcity char(3),tocity char(3),air1 char(2),via1 char(3),air2 char(2),via2 char(3),air3 char(2),via3 char(3),air4 char(2),toplace char(25),fromplace char(25),fare money,farebasiscode int,clsofservice1 char(1),clsofservice2 char(1),notes char(20),stop int)"
cmd.execute
Set cmd=Server.CreateObject("ADODB.Command"

cmd.ActiveConnection = dbConnect
sql="insert #temptable select * from itinerary"
cmd.CommandText = sql
cmd.execute
' until here everything still is ok
' start of the error codes
Set rs=Server.CreateObject("ADODB.Recordset"

sql="select * from itinerary2"
rs.open sql,dbConnect
do while not rs.eof
Set rs2=Server.CreateObject("ADODB.Recordset"

sql="select aircode from airlines"
rs2.open sql,dbConnect
do while not rs2.eof
Set cmd=Server.CreateObject("ADODB.Command"

cmd.ActiveConnection = dbConnect
sql="insert #temptable values(" & rs2.fields("aircode"

.....etc..
cmd.Commandtext=sql
cmd.execute
' the command above generates error
rs2.movenext
loop
rs2.movefirst
end if
rs.movenext
loop
' end of error codes
sql="select * from #temptable order by fare"
Set rst=Server.CreateObject("ADODB.Recordset"

rst.open sql,dbConnect
do while not rst.eof
response.write rst.fields("aircode"

response.write rst.fields("fare"

response.write rst.fields("fromcity"

response.write rst.fields("tocity"

%><br><%
rst.movenext
loop
Set cmd=Server.CreateObject("ADODB.Command"

cmd.ActiveConnection = dbConnect
cmd.CommandText = "drop table #temptable"
cmd.execute
%>
My problem is : if I only execute 2 the two first SQL commands , everything is ok, but when I include the "error codes", it generates an error is " Invalid object name #temptable". I try to change the temp table into global (##) , and it works but when there are two connection simultaneously connects to database, only one connection succeed, the other will receive an error message is " There are already have an object ##temptable", and I don't want to use this solution because the results of each connection is diferent and each connection should have its own temp table in its session.
Do you have any advise for me ? I greatly appreciate your helps