-
Apr 11th, 2006, 04:07 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] 2 DB for datagrid
is it possible to select from two tables in two datbase's and put them in the same datagrid.
if so any pointers???
it works 60% of the time, all the time.
-
Apr 11th, 2006, 05:39 AM
#2
Thread Starter
Fanatic Member
it works 60% of the time, all the time.
-
Apr 11th, 2006, 08:18 AM
#3
Fanatic Member
Re: 2 DB for datagrid
Manually insert the data into a dataset, then bind the dataset to a datagrid.
-
Apr 11th, 2006, 08:35 AM
#4
Frenzied Member
Re: 2 DB for datagrid
Originally Posted by d2005
is it possible to select from two tables in two datbase's and put them in the same datagrid.
if so any pointers???
Well if the database you are using will let you do a multiple database table join to populate whatever control you are binding your datagrid to it is really simple. For example SQL Server will let you join tables from different databases just by using the fully qualified database name.
Code:
SELECT A.*, b.* FROM [DB_A].[dbo].[Table1] A LEFT OUTER JOIN [DB_B].[dbo].[Table1] B ON A.ID = B.ID
Now if it is 2 different types of databases (e.g. SQL Server/Oracle), I would do what the other said and build you data source (e.g. dataset) manually. Datasets for example have I think NewRow and AddRow functions, so you can construct each row by pulling data from each table and assigning row items from that data and then add it to your datatable.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Apr 12th, 2006, 04:55 AM
#5
Thread Starter
Fanatic Member
it works 60% of the time, all the time.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|