Solved

Accesing temporary tables in SQL Server using Ado components

Posted on 2004-10-11
5
363 Views
Last Modified: 2013-11-23
Hi,

I'm using Delphi 7 and Ado components to connect to a SQL Server 2000 server.
I have a T-SQL routine that creates serveral #Temporary tables.
So, I want to first, call this routine from my form, then call individidual TAdoQuerys to retrieve each individual of the resultsets.

Since all the components share the same connection (I have only one TAdoConnection in my app), this seems to be supposed to work, since temporary tables, belong to the current user's connection.
However, it doesn't work so. After I call the routine that creates the temporary tables (using either a TAdoCommand or a TAdoQuery), I have the temporary tables created, but my calls to retrieve the tables (Select * From #Temp1), return me the error "Invalid object name #Temp1"


Regards,
0
Comment
Question by:fischermx
5 Comments
 
LVL 6

Expert Comment

by:vadim_ti
Comment Utility
only suggestions:

1)may be your KeepConnection is false, and connection is closed?
2)try to check the same with global temporary table ##temp1
so you will know if a problem is with a connection
0
 
LVL 5

Expert Comment

by:Voodooman
Comment Utility

Hi

When you create the temp tables - make sure the queries  are server side.

I am not sure how you do that with Delphi (I dont use ADo with Delphi - only VB)

Then do a simple test on the connection by executing a query like

conn.execute('Select into #temp from Customers');

and then

But it goes something like MyDs=conn.open('Select * from #Temp');

That should work (excuse my Delphi here but like I said I dont use ADO with Delphi)

Voodooman

0
 
LVL 1

Author Comment

by:fischermx
Comment Utility
The solution was to create the temporary tables in one command, then in a second command fill them and then perform as many individual commands as temporaty tables to retrieve each results sets.
Sorry, for post this too late.
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
Comment Utility
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now