Avatar of tigriswoods
tigriswoods

asked on 

Possible to "select" from a sqldatasource?

I'm still learning how to use sqldatasource and have a question.
I have a sqldatasource associated with a gridview.  I'd like to be able to query against the "result set" of the sqldatasource. Does there exist a temp table for the sqldatasource that I can use in another query?  If there is already a temp table, I'd like to be able to use it.  Does anyone know if this is possible, and if so, how to do it?  Or alternatively, how to select the sqldatasource into a temp table?

(I know how to iterate through each row of the dataview to get the column value I need  as a parameter in a related query.  However, rather than issuing one query per row, I'd like to make a temp table and use it in  a join in my related query , so that I execute the related query just once.  Before I write code to manually create the temp table, I thought I'd ask to see if one already exists,)


Visual Basic.NETMicrosoft SQL Server 2005SQL

Avatar of undefined
Last Comment
ororiole
Avatar of ororiole
ororiole
Flag of United States of America image

You mean a temp table as in a temp table on sql server? A sql data source just executes the query assigned to it and returns the result set. If you sent the string "Select * from myTable" to a database on sqlserver for execution, its the same thing. And its not going to be kept around. So no, there is no table tied to a sqldatasource control that you can access.

I can show you how to get the .net DataTable that is returned by the sqldatasource select command, but that is on the application side.
Avatar of tigriswoods
tigriswoods

ASKER

Thanks for your response, even if it's not exactly what I had hoped to hear.  Is there any existing function that convert the ,net data table into a temp table?  That would work just as well.  
Avatar of ororiole
ororiole
Flag of United States of America image

Do you mean to take the .net datatable and put it in sqlserver as a #temp table?
Avatar of tigriswoods
tigriswoods

ASKER

Yes.  Using a temp table is ultimately what I want to do, so creating it from the .net datatable is just as good of a solution.  
ASKER CERTIFIED SOLUTION
Avatar of ororiole
ororiole
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo