Hi, I running the following code in an asp and get the error below Microsoft OLE DB Provider for ODBC Drivers error '80040e37' [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name CODE: -------------------------------------------------------------------------------- REM adovbs.inc included at top of page
<!---#Include File="../includes/adovbs.inc" -->
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<%
'----- Setup database connection
Set DataCmd = Server.CreateObject("ADODB.Connection")
Set rsData = Server.CreateObject("ADODB.RecordSet")
Dim varTempTableName
DataCmd.Open Application("DB")
'----- Use a Temp Table so that it gets destroyed automatically in case the page times out
'----- Use a Global Temp Table so that it is available across scopes when I open the record set below
'----- Append a semi unique number to the end because its global it could conflict with another browser running the same report
'varTempTableName = "##t_TestTemp" & Minute(Now()) & Second(Now())
varTempTableName = "#t_TestTemp" & Session.SessionID
strSQL = "Create Table " & varTempTableName & "(TestColumn2 int)"
DataCmd.Execute strSQL
'Response.Write "1- Works after Create Temp table name: " & varTempTableName & VBCRLF
strSQL = "select * from t_Test"
rsData.Open strSQL, DataCmd, adOpenForwardOnly,adLockReadOnly
'Response.Write "2- Works after Select * from t_Test Temp table name: " & varTempTableName & VBCRLF
Do While Not rsData.EOF
varTestColumn2 = rsData("TestColumn2")
Rem this line is causing the error code works fine without the insert statement below
strSQL = "Insert into " & varTempTableName & " (TestColumn2) values (" & varTestColumn2 & ")"
DataCmd.Execute strSQL
rsData.MoveNext
Loop
rsData.Close
strSQL = "Drop Table " & varTempTableName
DataCmd.Execute strSQL
Set rsData = Nothing
Set DataCmd = Nothing
%>
</BODY>
</HTML>

Help with SQL Server ERROR '80040e37' FROM asp