Results 1 to 5 of 5

Thread: [RESOLVED] 2 DB for datagrid

  1. #1

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Resolved [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.

  2. #2

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: 2 DB for datagrid

    anyone??
    it works 60% of the time, all the time.

  3. #3
    Fanatic Member
    Join Date
    Jun 2005
    Posts
    625

    Re: 2 DB for datagrid

    Manually insert the data into a dataset, then bind the dataset to a datagrid.

  4. #4
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Re: 2 DB for datagrid

    Quote 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.

  5. #5

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    Re: 2 DB for datagrid

    thanks guys
    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
  •  



Click Here to Expand Forum to Full Width