Sub Query in ASP.NET ?

S

S. Justin Gengo

Ismail,

If you really need the data to be combined into one single table then you'll
have to create a second query to get the data out of table b. Then loop
through the rows returned adding them to table a something like this:
Dim Row As DataRow
For Each TableBDataRow As DataRow In TableB.Rows
Row = TableA.NewRow
'---Fill "Row" here.
Row.Item("FirstColumn") = TableBDataRow.Item("FirstColumn")
TableA.Rows.Add(Row)
Next

TableA.AcceptChanges()


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
S

SSW

I think ur taling abour Sql Server Sub Query.

If that is case then

Let's say we have
Table dbo.Tab_A in database DB_A
Table dbo.Tab_B in database DB_B
Both having same structure and i want get data from Tab_B and copy to Tab_A.
Then the SQL will be as below

Insert into DB_A.dbo.Tab_A
Select *
from DB_B.dbo.Tab_B

Yes u also need to have rigths for both the tables in bothe the database.

If the database is in other Database SQL server the U can user OPENQUERY
Command See SQL help file for that...

Thanks,

sswalia
 
I

Ismail Rajput

How to create SQL Sub-Query in ASP.NET , if the sub query retrieves records
from another database ?

For Example i have a Database A table A in one database B and a table B.
I want to receive some records from Database B table B and save into
Database A table A
 
I

Ismail Rajput

So we can't do using sub query ?


S. Justin Gengo said:
Ismail,

If you really need the data to be combined into one single table then you'll
have to create a second query to get the data out of table b. Then loop
through the rows returned adding them to table a something like this:
Dim Row As DataRow
For Each TableBDataRow As DataRow In TableB.Rows
Row = TableA.NewRow
'---Fill "Row" here.
Row.Item("FirstColumn") = TableBDataRow.Item("FirstColumn")
TableA.Rows.Add(Row)
Next

TableA.AcceptChanges()


--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
S

S. Justin Gengo

Ismail,

Check out SSW's answer. He's right, that if you want to do a true sub-query
then you would do that right in your sql statement/stored proc.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
D

dilipdotnet at apdiya.com

What do you mean by SubQuery in Asp.net!

Ismail said:
Thanks Dear ,

I think i know this already , i am sorry i didn't or
could not describe my problem . You take it like this , I have 2 different
domains in one web server(means there is one SQL Server which have two
different databases related to two different domains or websites you can
say ) so i have to logon to two different databases? Yes

Now how can i retrieve records and save? using subquery?
 
I

Ismail Rajput

Thanks Dear ,

I think i know this already , i am sorry i didn't or
could not describe my problem . You take it like this , I have 2 different
domains in one web server(means there is one SQL Server which have two
different databases related to two different domains or websites you can
say ) so i have to logon to two different databases? Yes

Now how can i retrieve records and save? using subquery?
 
I

Ismail Rajput

Yes

dilipdotnet at apdiya.com said:
What do you mean by SubQuery in Asp.net!



--
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilipdotnet at apdiya dot com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top