473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

HELP, Create Table o the fly from dataset

Bear with me, please... :)

TableA on Database1:
CodCli -- Name -- Age -- SalesCod
(...) (...) (...) (...)

TableB on Database2:
Key -- CodCli -- Date -- Value
(...) (...) (...) (...)

[Using Vs 2003.net Crystal Report]

We need to see and print all rows from TableB that as the SalesCod = "user
input".
Something like:
Select CodCli from TableA where SalesCod= "User Input" and (select * from
tableB
I can not do this because the tables are in diferent databases :(((

My solution:
1) Create 2 datasets from tableA and TableB
2) Create on the fly 1(one) table in the database, that as the information
from the two tables.(put the 2 datasets into the table).
3) create a new dataset from the new table and then query this new table.

I have no idea on how to implement point 2).

If anyone has o new idea please point me in the right way....I´m complety
lost
Nov 16 '05 #1
2 6020
Hi Paul,

Actually, you can include tables from different databases into a single SQL
statement. You will only have to add the database names to the table names:

SELECT Database1.TableA.CodCli From Database1.TableA Where
Database1.TableA.SalesCod = "User Input" INNER JOIN Database2.TableB ON
Database1.TableA.CodCli = Database2.TableB.CodCli

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Paul Oliveira" <Pa**********@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Bear with me, please... :)

TableA on Database1:
CodCli -- Name -- Age -- SalesCod
(...) (...) (...) (...)

TableB on Database2:
Key -- CodCli -- Date -- Value
(...) (...) (...) (...)

[Using Vs 2003.net Crystal Report]

We need to see and print all rows from TableB that as the SalesCod = "user
input".
Something like:
Select CodCli from TableA where SalesCod= "User Input" and (select * from
tableB
I can not do this because the tables are in diferent databases :(((

My solution:
1) Create 2 datasets from tableA and TableB
2) Create on the fly 1(one) table in the database, that as the information
from the two tables.(put the 2 datasets into the table).
3) create a new dataset from the new table and then query this new table.

I have no idea on how to implement point 2).

If anyone has o new idea please point me in the right way....I´m complety
lost


Nov 16 '05 #2
If the tables are in different databases but on the same sever

You could query the tables:

Select * from databaseA.dbo.TableA as tbla

Inner join databaseB.dbo.TableB as tblb on tbl1.codcli = tbl2.codcli

Otherwize you select what you want from the first table into a dataset and
what you want from the second table into another and then loop through them
and add rows from to the first from the second

I don't think that creating a new table is what you want as it would be
harder to ensure concurrency between the tables.

Cheers,

mortb

"Paul Oliveira" <Pa**********@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
Bear with me, please... :)

TableA on Database1:
CodCli -- Name -- Age -- SalesCod
(...) (...) (...) (...)

TableB on Database2:
Key -- CodCli -- Date -- Value
(...) (...) (...) (...)

[Using Vs 2003.net Crystal Report]

We need to see and print all rows from TableB that as the SalesCod = "user
input".
Something like:
Select CodCli from TableA where SalesCod= "User Input" and (select * from
tableB
I can not do this because the tables are in diferent databases :(((

My solution:
1) Create 2 datasets from tableA and TableB
2) Create on the fly 1(one) table in the database, that as the information
from the two tables.(put the 2 datasets into the table).
3) create a new dataset from the new table and then query this new table.

I have no idea on how to implement point 2).

If anyone has o new idea please point me in the right way....I´m complety
lost

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
6
by: Graham Pengelly | last post by:
Hi I'll try to spell out my problem as succinctly as possible... My database has a User table, an Organisation table, a Department table and a JobType table (amongst others) The...
6
by: Chad A. Beckner | last post by:
Does anyone know how to make common database connections "common" in all aspx files? In other words, instead of creating a SQLConnection, then a DataAdapter in every ASPX file for my application,...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
0
by: Rogelio Moreno | last post by:
Denis, I recommend you to bind the textbox controls to columns of your table inside your dataset, then get the bindingmanagerbase for the table, then use the position property of the...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
2
by: rufpirat | last post by:
Hello I'm in the middle of trying to build an "AD phone book", and this being my first try at asp.net, I have a few questions that I hope some of you might be able to help with: 1. Is it...
9
by: Tony Girgenti | last post by:
Hello I developed and tested a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1. It uses a web form. I tried doing this without any help, but i'm...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
1
by: =?Utf-8?B?RGFuIFNoZXBoZXJk?= | last post by:
I am playing around trying to learn how to manipulate data in VB 2005. I have code set to open up two db connections and pull in select data. Now what I need to do is loop through table 1, field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.