Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange Connection Behavior

Status
Not open for further replies.

dmh4ab

Programmer
Oct 2, 2002
53
US
This is really strange and is confusing me. My asp page connects to a SQL database and pulls recordsets. For this I need a temporary table which I create like this....

Code:
strSQL = "SELECT tbl_RepairSummary.BasicPartNumber, tbl_RepairSummary.RoutingCode, tbl_RepairSummary.RevLevel, tbl_RepairSummary.RevDate, tbl_RepairSummary.PartName, tbl_RepairSummary.Summary, tbl_RtgDash.DashNo, tbl_RtgDash.ModToPN, tbl_RtgDash.ModToDash, tbl_RepairSummary.InProcess, tbl_RepairSummary.Filename, tbl_RepairSummary.Inactivated INTO #tmp FROM tbl_RepairSummary LEFT JOIN tbl_RtgDash ON (tbl_RepairSummary.BasicPartNumber = tbl_RtgDash.BasicPartNumber) AND (tbl_RepairSummary.RoutingCode = tbl_RtgDash.RoutingCode) AND (tbl_RepairSummary.RevLevel = tbl_RtgDash.RevLevel) WHERE tbl_RepairSummary.BasicPartNumber = '" & Number & "' OR tbl_RtgDash.ModToPN = '" & Number & "';"
Conn.Execute strSQL

'Number' comes from user input to a text box. This works fine for the page, except that the third time the user types in a number to search for, the page throws an error....
"Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
There is already an object named '#tmp' in the database."

I'm lost. Any help would be appreciated!
Thanks,
dmh4ab
 
I recieve an error when trying this...

Code:
Conn.Execute strSQL
DROP TABLE #tmp

Expected end of statement
/myWeb/RoutingTrials.asp, line 24, column 11
DROP TABLE #tmp

Thanks again,
dmh4ab
 
DROP TABLE #tmp
GO

works?
or u can try
strSQL="DROP TABLE #tmp"
Conn.Execute strSQL


 
chmohan, thanks for all your help.

Using the strSQL and conn.Execute gives me another error...

"Microsoft OLE DB Provider for SQL Server (0x80040E37)
Invalid object name '#tmp'"

Thanks again,
dmh4ab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top