Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 19th, 2006, 07:09 AM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using a parameter with 2 queries

I want to use one field name i take from one query as the name of the table in another one query.
How can i manage this by using asp.net 2 Sqldatasources???

To make it more clear :
I have one SqlDatasource that is : "SELECT x,y FROM XY"
The y is the name of the table i want to use.
I want to use it in another query as ...
"SELECT * FROM 'y' "
How can i take 'y' and use it ???????

 
Old September 19th, 2006, 07:24 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Set y to a variable from your first query and do something like:

string sSql;
string sTable;

sTable = [value of first query];
sSql = "Select * from " + sTable;

//execute query

--Stole this from a moderator

I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
 
Old September 19th, 2006, 07:41 AM
Registered User
 
Join Date: Sep 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That is very obvious.
The problem is how to save the value from the <asp:SqlDataSource> component!
Or should i take the value from the <asp:GridView> where i am exporting these values?






Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with parameter queries ph0neman Classic ASP Basics 2 July 1st, 2008 08:57 PM
Parameter Queries designdawg Access 13 March 5th, 2008 01:39 PM
Parameter queries and make tables deanm5 Access VBA 1 April 13th, 2007 11:32 AM
Combining Parameter Queries Taarnac SQL Language 0 May 4th, 2005 11:13 AM
Exported Access Parameter Queries to Excel vallasca Access VBA 4 January 19th, 2005 07:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.